Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/suissa/atomicarray
Create Arrays easily
https://github.com/suissa/atomicarray
Last synced: 6 days ago
JSON representation
Create Arrays easily
- Host: GitHub
- URL: https://github.com/suissa/atomicarray
- Owner: suissa
- Created: 2016-07-04T02:14:31.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-07-04T03:36:44.000Z (over 8 years ago)
- Last Synced: 2024-10-30T01:45:24.238Z (about 2 months ago)
- Language: JavaScript
- Size: 109 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Atomic Array
```js
const atomicArray = require('atomic-array')
atomicArray.create(length, functionToCreateTheValue)
```For example lets create an Array with 10 elements filling with value 0:
```js
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](https://www.npmjs.com/package/random-numbers), [random-even-numbers](https://www.npmjs.com/package/random-even-numbers), [random-odd-numbers](https://www.npmjs.com/package/random-odd-numbers), etc.
```js
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 ]
```