(n, map) => Array.from({ length: n }, map)
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

nmap

Build Status NPM Version License

(n, map) => Array.from({ length: n }, map)

Installation

npm install nmap

API

  • nmap(n: length, map: function): any[]

Examples

const nmap = require("nmap");

nmap(4, () => 0);
// → [ 0, 0, 0, 0 ]

nmap(4, i => i);
// → [ 0, 1, 2, 3 ];

License

MIT