Share your code. Components are building blocks, you are the architect.

array/flat-map
v1.0.0
1.0.0
0.0.1
MIT
PUBLIC
1
0     DEPENDENCIES
Build: pass
BuildPass
Build Status: pass
Builds a new collection by applying a function to all elements of
bit
Contributors
Gravatar for undefinedGravatar for undefined
1

Please configure Bit as a scoped registry to install components with NPM.Learn more

npm config set '@bit:registry' https://node.bitsrc.io
Use array/flat-map in your project
npm i @bit/bit.utils.array.flat-map
Copied

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