interleavejs
Clojure's
interleave
function in JavaScript
The interleave function takes multiple arrays and produces a new array that interleaves values from each array until one of the array is exhausted.
Install
$ npm install --save interleavejs
Usage
const interleave = // [1, 'a', 2, 'b', 3, 'c'] // more arrays // [1, 4, 7, 2, 5, 8, 3, 6, 9] // array-like object // [1, 'a', 2, 'b', 3, 'c'] // return `[]` if there is only one array // []
API
interleavejs(arr1, arr2, ..., arrN)
arrN
Type: array or array-like object
License
MIT © JIANG Di