Create Arrays easily
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
node_modules
README.md
atomicArray.js
atomicArray.test.js
index.js
npm-debug.log
package.json

README.md

Atomic Array

const atomicArray = require('atomic-array')
atomicArray.create(length, functionToCreateTheValue)

For example lets create an Array with 10 elements filling with value 0:

atomicArray.create(10, () => 0)
// [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]

And how it´s a create function expected we can easily create random numbers using external modules like: random-numbers, random-even-numbers, random-odd-numbers, etc.

const atomicArray = require('atomic-array')
const randomNumbers= require('random-numbers')

const arr = atomicArray.create(10, randomNumbers.create)
// [ 88, 23, 55, 13, 4, 99, 16, 72, 81, 2 ]