|
Last change
on this file since e4c61dd was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago |
|
Prototype 1.1
|
-
Property mode
set to
100644
|
|
File size:
310 bytes
|
| Line | |
|---|
| 1 | export 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 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.