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

Function map

src/map.js:1–5  ·  view source on GitHub ↗
(values, mapper)

Source from the content-addressed store, hash-verified

1export default function map(values, mapper) {
2 if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable");
3 if (typeof mapper !== "function") throw new TypeError("mapper is not a function");
4 return Array.from(values, (value, index) => mapper(value, index, values));
5}

Callers 2

map-test.jsFile · 0.90
nestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected