Function Namespace Pot.zip
Defined in: <pot.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
Pot.zip(object, (callback), (context))
Create a new array which has the elements at
position ith of the provided arrays.
|
Field Attributes | Field Name and Description |
---|---|
Iterates "zip" loop with slower speed.
|
|
Iterates "zip" loop with fast speed.
|
|
Iterates "zip" loop with slowest speed.
|
|
Iterates "zip" loop with fastest speed.
|
|
Iterates "zip" loop with default speed.
|
|
Iterates "zip" loop with faster speed.
|
|
Iterates "zip" loop with slow speed.
|
Function Namespace Detail
Pot.zip(object, (callback), (context))
Create a new array which has the elements at
position ith of the provided arrays.
This function is handled as seen from the longitudinal for array
that is similar to the zip() function in Python.
Example: arguments: [[1, 2, 3], [4, 5, 6]] results: [[1, 4], [2, 5], [3, 6]]
var result = zip([[1, 2, 3], [4, 5, 6]]); debug(result); // @results // [[1, 4], [2, 5], [3, 6]] //
var result = zip([[1, 2, 3], [1, 2, 3, 4, 5]]); debug(result); // @results // [[1, 1], [2, 2], [3, 3]] //
var result = zip([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11]]); debug(result); // @results // [[1, 4, 7, 10], [2, 5, 8, 11]] //
var result = zip(['hoge']); debug(result); // @results // [['hoge']] //
var result = zip([[1], [2], [3]]); debug(result); // @results // [[1, 2, 3]] //
var result = zip([[1, 2, 3], ['foo', 'bar', 'baz'], [4, 5]]); debug(result); // @results // [[1, 'foo', 4], [2, 'bar', 5]] //
var callback = function(items) { return items[0] + items[1]; }; var result = zip([[1, 2, 3], [4, 5, 6]], callback); debug(result); // @results [5, 7, 9]
- Parameters:
- {Array} object
- An array to be combined.
- {Function} (callback)
- (Optional) Callback function. function({Array} items[, {*} object]) this == `context`.
- {*} (context)
- (Optional) Object to use as `this` when executing callback.
- Returns:
- {Array} A new array of arrays created from provided objects.
- See:
- http://docs.python.org/library/functions.html#zip
Field Detail
{Function}
doze
Iterates "zip" loop with slower speed.
{Function}
fast
Iterates "zip" loop with fast speed.
{Function}
limp
Iterates "zip" loop with slowest speed.
{Function}
ninja
Iterates "zip" loop with fastest speed.
{Function}
normal
Iterates "zip" loop with default speed.
{Function}
rapid
Iterates "zip" loop with faster speed.
{Function}
slow
Iterates "zip" loop with slow speed.