Skip to content

Makes one array by aggregating elements from other arrays.

License

Notifications You must be signed in to change notification settings

abrelsfo/arrzip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

arrzip

npm version Build Status NPM downloads

Makes an array that aggregates elements from each of the arrays.

Installation

npm install arrzip

Usage

var zip = require('../arrzip');

var a = [1,2,3,4];
var b = [6,7,8,9,0];
var c = [10,11,12,13,14,15];
var longest = zip(a,b,c,true);
var shortest = zip(a,b,c);

console.log(longest);
//=>[ [ 1, 6, 10 ], [ 2, 7, 11 ], [ 3, 8, 12 ], [ 4, 9, 13 ], [ 0, 14 ], [ 15 ] ]

console.log(shortest);
//=>[ [ 1, 6, 10 ], [ 2, 7, 11 ], [ 3, 8, 12 ], [ 4, 9, 13 ] ]

API

zip(*arguments[, longest])

*arguments

Type: Array
Condition: N number of arrays

longest

Type: Boolean
true: zip based on longest Array
false: zip based on shortest Array
default: false

Merge N number of arrays by shortest or longest array

##License

MIT © Alex Brelsford

About

Makes one array by aggregating elements from other arrays.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages