Function Namespace Pot.items
Defined in: <potlite.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
Pot.items(object, (callback), (context))
Collect the object key and value and make array as items format.
|
Field Attributes | Field Name and Description |
---|---|
Iterates "items" loop with slower speed.
|
|
Iterates "items" loop with fast speed.
|
|
Iterates "items" loop with slowest speed.
|
|
Iterates "items" loop with fastest speed.
|
|
Iterates "items" loop with default speed.
|
|
Iterates "items" loop with faster speed.
|
|
Iterates "items" loop with slow speed.
|
Function Namespace Detail
Pot.items(object, (callback), (context))
Collect the object key and value and make array as items format.
var obj = {foo: 1, bar: 2, baz: 3}; debug(items(obj)); // @results [['foo', 1], ['bar', 2], ['baz', 3]]
var array = ['foo', 'bar', 'baz']; debug(items(array)); // @results [[0, 'foo'], [1, 'bar'], [2, 'baz']]
// Example for using callback. var arr = ['foo', 'bar', 'baz']; var func = function(item) { return '(' + item[0] + ')' + item[1]; }; debug(items(arr, func)); // @results ['(0)foo', '(1)bar', '(2)baz']
// Example for using callback. var obj = {foo: 1, bar: 2, baz: 3}; var func = function(item) { return [item[0] + '::' + item[1]]; }; debug(items(obj, func)); // @results [['foo::1'], ['bar::2'], ['baz::3']]
- Parameters:
- {Object|Array} object
- The target object or an array.
- {Function} (callback)
- (Optional) Callback function. function({Array} item[, object]) this == `context`.
- {*} (context)
- (Optional) Object to use as `this` when executing callback.
- Returns:
- {Array} The collected items as an array.
Field Detail
{Function}
doze
Iterates "items" loop with slower speed.
{Function}
fast
Iterates "items" loop with fast speed.
{Function}
limp
Iterates "items" loop with slowest speed.
{Function}
ninja
Iterates "items" loop with fastest speed.
{Function}
normal
Iterates "items" loop with default speed.
{Function}
rapid
Iterates "items" loop with faster speed.
{Function}
slow
Iterates "items" loop with slow speed.