source: trip-planner-front/node_modules/fast-glob/out/utils/array.js@ 571e0df

Last change on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 608 bytes
Line 
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.splitWhen = exports.flatten = void 0;
4function flatten(items) {
5 return items.reduce((collection, item) => [].concat(collection, item), []);
6}
7exports.flatten = flatten;
8function splitWhen(items, predicate) {
9 const result = [[]];
10 let groupIndex = 0;
11 for (const item of items) {
12 if (predicate(item)) {
13 groupIndex++;
14 result[groupIndex] = [];
15 }
16 else {
17 result[groupIndex].push(item);
18 }
19 }
20 return result;
21}
22exports.splitWhen = splitWhen;
Note: See TracBrowser for help on using the repository browser.