githubEdit

ArrayZip

Returns a zipped array.

 arrayZip( [ 1, 2 ], [ "a", "b" ] );
 // [ [ 1, "a" ], [ 2, "b" ] ]

 arrayZip( [ 1, 2 ], [ 10, 20 ], ( a, b ) => a + b );
 // [ 11, 22 ]
 

Method Signature

ArrayZip(array1=[array], array2=[array], callback=[function], parallel=[boolean], maxThreads=[any], virtual=[boolean])

Arguments

Argument
Type
Required
Description
Default

array1

array

true

The first array to zip

array2

array

true

The second array to zip

callback

function

false

An optional callback function to receive the item and the current index from both zipped arrays and return a new value.

parallel

boolean

false

If true, the function will be invoked in parallel using multiple threads. Defaults to false.

false

maxThreads

any

false

The maximum number of threads to use when parallel is true. If not provided the common thread pool will be used. If a boolean value is passed, it will be assigned as the virtual argument.

virtual

boolean

false

If true, the function will be invoked using virtual thread. Defaults to false. Ignored if parallel is false.

false

Examples

Last updated

Was this helpful?