List of utility methods to do Array Flat Map
flatMap(callback)Array.prototype.flatMap = function(callback) { var inputArray = this; var start = function(value, index, length) { flatEach(value.shift()); ++index != length && start(value, index, length); return value; var flatEach = function(eachValue) { return Array.isArray(eachValue) ? start(eachValue, 0, eachValue.length) : inputArray.push(callback(eachValue)); ... | |
flatMap(cb)Array.prototype.flatMap = function (cb) { return this.map(cb).reduce(function (arr, c) { return arr.concat(c); }, []); }; | |
flatMap(fn, ctx)Array.prototype.flatMap = function(fn, ctx) { return this.reduce((k, v) => k.concat(fn.call(ctx, v)), []); }; | |
flatMap(lambda)Array.prototype.flatMap = function(lambda) { return Array.prototype.concat.apply([], this.map(lambda)); }; | |
flatMap(lambda)Array.prototype.flatMap = function(lambda) { return [].concat(this.map(lambda)); }; | |
flatMap(lambda)Array.prototype.flatMap = Array.prototype.flatMap || function(lambda) { return Array.prototype.concat.apply([], this.map(lambda)); | |
flatMap(mapFunc)Array.prototype.flatMap = function(mapFunc) { var result = [] for (let item of this) { let tokens = mapFunc(item) result = result.concat(tokens) return result | |
flatMap(projection)Array.prototype.flatMap = function(projection) { return this. map(function(item) { return projection(item); }). mergeAll(); |