array/flat-map
v0.0.1
0.0.1
Collaborators
Gravatar for undefined
0
MIT
PUBLIC
0
0     DEPENDENCIES
BuildPass

Builds a new collection by applying a function to all elements of

Use array/flat-map in your project
npm i @bit/bit.utils.array.flat-map

flatMap (array:[*], cb:Function) : [*]

Builds a new collection by applying a function to all elements of this array and using the elements of the resulting collections.

Example

flatMap([[1, 2, 3], [4, 5, 6]], val => val) // => [1, 2, 3, 4, 5, 6]

Arguments

array: [*]

cb: Function

Returns

[*]

Test Summary


#flatMap() should flatten the multi-dimensional array to a single-dimensional one Pass
#flatMap() should flatten to a single-dimensional array without odd numbersPass
#flatMap() should throw a type error in case the first argument is not an arrayPass
#flatMap() should throw a type error in case the second argument is not a functionPass