@sullux/fp-light-concat

0.0.1 • Public • Published

home

fp-light-concat

npm i @sullux/fp-light-concat source test

Concatenates values into a single iterable.

concat

concat(...iterables: Array<mixed>): { @@iterator(): Iterator<mixed> }

This function does a shallow concatenation of iterables, objects and values and returns the concatenated iterable. The unit test for the concat function demonstrates how it handles various types of inputs:

const { deepStrictEqual } = require('assert')

const { concat } = require('./concat')

const date = new Date()

describe('concat', () => {
  it('should concatenate iterables', () => deepStrictEqual(
    [...concat(
      [1, 2],
      null,
      undefined,
      { foo: 42 },
      function* () { yield 'bar' },
      date,
      concat(true, false, [3, 4]),
    )],
    [1, 2, null, undefined, ['foo', 42], 'bar', date, true, false, 3, 4]
  ))
})

Readme

Keywords

Package Sidebar

Install

npm i @sullux/fp-light-concat

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

1.97 kB

Total Files

3

Last publish

Collaborators

  • sullux