partial.js logo
Latest version
v1.3.1 (RC2)

Array.prototype


Array prototype is available in each node.js / partial.js script. Prototypes are defined in FrameworkUtils (utils.js). FrameworkUtils is a global variable.

Methods


Array.prototype.find(fn)Array.prototype.random()Array.prototype.randomize()Array.prototype.remove(fn)Array.prototype.skip(count)Array.prototype.take(count)Array.prototype.waiting(onItem, [onComplete])Array.prototype.where(fn)
Array.prototype.find(fn);
return Object;

Find first item in array.

Array.prototype.random();
return Object;

Random one item from array.

Array.prototype.randomize();
return Array;

Randomize array. Example: [1, 2, 3, 4].randomize(), result: [4, 1, 3, 2]

Array.prototype.remove(fn);
return Array;

Remove specific items from array. If (fn) return true - then is item removed from array.

Array.prototype.skip(count);
return Array;

Skip items in array.

Array.prototype.take(count);
return Array;

Take items from array.

Array.prototype.waiting(onItem, [onComplete]);
return Array;

This function removed asynchronically first item and then executes onItem parameter. If array is empty then executes onComplete parameter.

Array.prototype.where(fn);
return Array;

Create a collection from array by the 'fn' function.