source: node_modules/es-toolkit/dist/array/partition.js

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

Added visualizations

  • Property mode set to 100644
File size: 448 bytes
Line 
1'use strict';
2
3Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
5function partition(arr, isInTruthy) {
6 const truthy = [];
7 const falsy = [];
8 for (let i = 0; i < arr.length; i++) {
9 const item = arr[i];
10 if (isInTruthy(item, i, arr)) {
11 truthy.push(item);
12 }
13 else {
14 falsy.push(item);
15 }
16 }
17 return [truthy, falsy];
18}
19
20exports.partition = partition;
Note: See TracBrowser for help on using the repository browser.