Here you can find the source of concatMap(projectionFunctionThatReturnsArray)
Array.prototype.concatMap = function(projectionFunctionThatReturnsArray) { return this.// w ww .java 2 s . c om map(function(item) { return this.map((i) => { return i; }).concatAll(); }). // apply the concatAll function to flatten the two-dimensional array concatAll(); }; /* var spanishFrenchEnglishWords = [ ["cero","rien","zero"], ["uno","un","one"], ["dos","deux","two"] ]; // collect all the words for each number, in every language, in a single, flat list var allWords = [0,1,2]. concatMap(function(index) { return spanishFrenchEnglishWords[index]; }); return JSON.stringify(allWords) === '["cero","rien","zero","uno","un","one","dos","deux","two"]'; */
'use strict'; let j = require('junify'); Array.prototype.concatMap = function (f) { return Array.prototype.concat.apply([], this.map(f)); }; j.matchesAny = function (patterns) { return (it) => patterns.some(pattern => j.unify(pattern, it)); }; j.match = function (arg, cases) { ...
Array.prototype.concatMap = function(fn) { return this .map((item, index, arr) => fn(index)) .concatAll(); };
Array.prototype.concatMap = function (modifierFunction) { return this.map(modifierFunction).concatAll();
Array.prototype.concatMap = function(projectionFunction){ return this.map(function(item){ return projectionFunction(item); }).concatAll();
Array.prototype.concatMap = function (projectionFunctionThatReturnsArray) { return this. map(function (item) { return projectionFunctionThatReturnsArray(item); }). concatAll(); };
Array.prototype.concatMap = function(projectionFunctionThatReturnsArray) { return this. map(function(item) { return projectionFunctionThatReturnsArray(item); }). concatAll(); };