MCPcopy Create free account
hub / github.com/d3/d3-array / filter

Function filter

src/filter.js:1–11  ·  view source on GitHub ↗
(values, test)

Source from the content-addressed store, hash-verified

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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…