All Downloads are FREE. Search and download functionalities are using the official Maven repository.

node_modules.concat-map.index.js Maven / Gradle / Ivy

There is a newer version: 1.1.2
Show newest version
module.exports = function (xs, fn) {
    var res = [];
    for (var i = 0; i < xs.length; i++) {
        var x = fn(xs[i], i);
        if (isArray(x)) res.push.apply(res, x);
        else res.push(x);
    }
    return res;
};

var isArray = Array.isArray || function (xs) {
    return Object.prototype.toString.call(xs) === '[object Array]';
};




© 2015 - 2024 Weber Informatics LLC | Privacy Policy