source: node_modules/es-toolkit/dist/compat/array/flatMap.mjs

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 372 bytes
RevLine 
[a762898]1import { flattenDepth } from './flattenDepth.mjs';
2import { map } from './map.mjs';
3import { isNil } from '../../predicate/isNil.mjs';
4
5function flatMap(collection, iteratee) {
6 if (isNil(collection)) {
7 return [];
8 }
9 const mapped = isNil(iteratee) ? map(collection) : map(collection, iteratee);
10 return flattenDepth(mapped, 1);
11}
12
13export { flatMap };
Note: See TracBrowser for help on using the repository browser.