12345678910111213141516171819202122232425262728293031 |
- "use strict";
- function partitionArray(array, predicate, context) {
- var first = [];
- var second = [];
- array.forEach(function (element, index) {
- if (predicate.call(context, element, index, array)) {
- first.push(element);
- } else {
- second.push(element);
- }
- });
- return [first, second];
- }
- module.exports = partitionArray;
|