UNPKG

charlike

Version:

Small, fast, simple and streaming project scaffolder for myself, but not only. Supports hundreds of template engines through the @JSTransformers API or if you want custom `render` function passed through options

12 lines (10 loc) 280 B
module.exports = function (xs, f) { if (xs.map) return xs.map(f); var res = []; for (var i = 0; i < xs.length; i++) { var x = xs[i]; if (hasOwn.call(xs, i)) res.push(f(x, i, xs)); } return res; }; var hasOwn = Object.prototype.hasOwnProperty;