Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

zip

Zip one or more arrays.

Usage

var zip = require( '@stdlib/array/base/zip' );

zip( arrays )

Zips one or more arrays.

var x = [ 1, 2 ];
var y = [ 3, 4 ];

var out = zip( [ x, y ] );
// returns [ [ 1, 3 ], [ 2, 4 ] ]

The function supports the following parameters:

  • arrays: list of arrays to zip.
  • The function assumes that the list of arrays to be zipped all have the same length.

Examples

var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
var zeroTo = require( '@stdlib/array/base/zero-to' );
var zip = require( '@stdlib/array/base/zip' );

var x = zeroTo( 10 );
var y = discreteUniform( x.length, -100, 100 );

var out = zip( [ x, y ] );
// returns [...]