array-interweave
v1.0.0
Published
Produce a new array from two source arrays with alternating values from each source array
Downloads
4
Readme
array-interweave
Produce a new array from two source arrays with alternating values from each source array.
Installation
$ npm install array-interweave --save
Usage
const interweave = require('array-interweave')
const sourceA = [1, 2, 3, 4, 5]
const sourceB = ['A', 'B', 'C']
const mergedResult = interweave(sourceA, sourceB)
// => [1, 'A', 2, 'B', 3, 'C', 4, 5]
const interweave = require('array-interweave')
const sourceA = [0x55, {foo: 'bar'}, 'apples']
const sourceB = [1, 2, 3, 4, 5]
const mergedResult = interweave(sourceA, sourceB)
// => [0x55, 1, {foo: 'bar'}, 2, 'apples', 3, 4, 5]
Tests
iUnit tests use Mocha, Unit.js, and Istanbul
$ npm run test
$ npm run test-html-cov # Will open HTML coverage report in Google Chrome on OSX
License
MIT