Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bahamas10/node-stretch
Stretch out the contents of an array like a rubber band
https://github.com/bahamas10/node-stretch
Last synced: about 2 months ago
JSON representation
Stretch out the contents of an array like a rubber band
- Host: GitHub
- URL: https://github.com/bahamas10/node-stretch
- Owner: bahamas10
- Created: 2014-05-07T02:26:56.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-05-07T02:28:06.000Z (over 10 years ago)
- Last Synced: 2024-04-13T22:08:30.741Z (8 months ago)
- Language: JavaScript
- Size: 137 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
stretch
=======Stretch out the contents of an array like a rubber band
Install
-------npm install stretch
Example
-------``` js
> var stretch = require('./')> stretch(['cat', 'dog'], 4)
[ 'cat', 'cat', 'dog', 'dog' ]
> stretch(['cat', 'dog'], 8)
[ 'cat', 'cat', 'cat', 'cat', 'dog', 'dog', 'dog', 'dog' ]> stretch([0,1,0], 6)
[ 0, 0, 1, 1, 0, 0 ]
> stretch([0,1,0], 9)
[ 0, 0, 0, 1, 1, 1, 0, 0, 0 ]
> stretch([0,1,0], 12)
[ 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 ]> stretch([0,1,0], 5)
[ 0, 0, 1, 1, 0 ]
```License
-------MIT