Ohm-Management - Projektarbeit B-ME
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 345B

12345678910111213
  1. module.exports = function (xs, fn) {
  2. var res = [];
  3. for (var i = 0; i < xs.length; i++) {
  4. var x = fn(xs[i], i);
  5. if (isArray(x)) res.push.apply(res, x);
  6. else res.push(x);
  7. }
  8. return res;
  9. };
  10. var isArray = Array.isArray || function (xs) {
  11. return Object.prototype.toString.call(xs) === '[object Array]';
  12. };