You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 280 B

3 years ago
1234567891011
  1. module.exports = function (xs, f) {
  2. if (xs.map) return xs.map(f);
  3. var res = [];
  4. for (var i = 0; i < xs.length; i++) {
  5. var x = xs[i];
  6. if (hasOwn.call(xs, i)) res.push(f(x, i, xs));
  7. }
  8. return res;
  9. };
  10. var hasOwn = Object.prototype.hasOwnProperty;