(n, map) => Array.from({ length: n }, map)
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
.travis.yml
README.md
index.js
package.json
test.js

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