
flatmap-fast
The fastest flatMap this side of node.
Takes two arguments:
- An array.
- A callback function (optional).
const flatMap = require("flatmap-fast");
const testArr = ['Hi', 'World'];
const splitWord = (word) => word.split('');
flatMap(testArr, splitWord);
flatMap([1, 2, 3, 4], (x) => [x, x * 2]);
Run npm test to test this flatMap against other flatMaps.
$ node --version
v12.18.3
$ yarn test
yarn run v1.22.4
$ node test.js
[
'H', 'i', 'W',
'o', 'r', 'l',
'd'
]
[
'H', 'i', 'W',
'o', 'r', 'l',
'd'
]
[
1, 2, 2, 4,
3, 6, 4, 8
]
[
1, 2, 2, 4,
3, 6, 4, 8
]
Done in 2.74s.