Returns the result of applying concat to the result of applying a function to arrays. Thus the function should return an array.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
.jshintrc
.travis.yml
LICENSE
README.md
index.js
package.json
test.js

README.md

Build Status

mapconcat

Returns the result of applying concat to the result of applying a function to values.

Install

npm i -S mapconcat

Usage

var assert = require('assert');
var mapconcat = require('mapconcat');

function reverse(arr) {
  return arr.reduce(function(acc, val, idx) {
    return acc.concat(arr[arr.length - idx - 1]);
  }, []);
}

var a = [3, 2, 1];
var b = [6, 5, 4];
var arr = mapconcat([a, b], reverse);
assert.deepEqual(arr, [1, 2, 3, 4, 5, 6]); // true