12345678910111213141516171819202122 |
- var makeIterator = require('../function/makeIterator_');
- /**
- * Array map
- */
- function map(arr, callback, thisObj) {
- callback = makeIterator(callback, thisObj);
- var results = [];
- if (arr == null){
- return results;
- }
- var i = -1, len = arr.length;
- while (++i < len) {
- results[i] = callback(arr[i], i, arr);
- }
- return results;
- }
- module.exports = map;
|