source: node_modules/d3-array/src/filter.js

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

Prototype 1.1

  • Property mode set to 100644
File size: 291 bytes
Line 
1export default function filter(values, test) {
2 if (typeof test !== "function") throw new TypeError("test is not a function");
3 const array = [];
4 let index = -1;
5 for (const value of values) {
6 if (test(value, ++index, values)) {
7 array.push(value);
8 }
9 }
10 return array;
11}
Note: See TracBrowser for help on using the repository browser.