- column
- empty
- last
- exists
- exists
- get
- isEmpty
- left
- move
- remove
- right
- shuffle
- start
- sum
- down
- first
- last
- up - Alias of left
Return the values from a single column
[
[1,2,3,4,5],
[6,7,8,9,0],
[1,3,4,6,9]
].column(0) // returns [1,6,1]
Truncate Array
var a = [1,2,3,4,5,6,7,8,9,0];
a.empty();
console.log(a); // returns []
IMPORTANT: Alias of last
Get the last item
[1,2,3,4,5,6,7,8,9,0].end() // returns 0
Check if item exists by index
[1,2,3,4,5,6,7,8,9,0].exists(0) // returns true
[1,2,3,4,5,6,7,8,9,0].exists(-1) // returns false
[1,2,3,4,5,6,7,8,9,0].exists(10) // returns false
[1,2,3,4,5,6,7,8,9,0].exists(9) // returns true
Get a item by index. If it not exists, return you own default value
[1,2,3,4,5,6,7,8,9,0].get(0) // returns 1
[1,2,3,4,5,6,7,8,9,0].get(-1, false) // returns false
[1,2,3,4,5,6,7,8,9,0].get(-1) // returns undefined
Check if a empty Array
var a = [];
var b = [1,2,3,4,5,6,7,8,9,0];
a.isEmpty() // returns true
b.isEmpty() // returns false
Move item to left position by index
[1,2,3,4,5,6,7,8,9,0].left(0); // returns [1,2,3,4,5,6,7,8,9,0]
[1,2,3,4,5,6,7,8,9,0].left(9); // returns [1,2,3,4,5,6,7,9,8,0]
Move a item by index position to a new index position
[0,1,2,3,4,5,6,7,8,9].move(0, 9); // returns [1,2,3,4,5,6,7,8,9,0]
Remove a item by index
[1,2,3,4,5,6,7,8,9,0].remove(0); // returns true
// produces
// [2,3,4,5,6,7,8,9,0]
Move item to right position by index
[1,2,3,4,5,6,7,8,9,0].right(0); // returns [1,2,3,4,5,6,7,8,9,0]
[1,2,3,4,5,6,7,8,9,0].right(9); // returns [1,2,3,4,5,6,7,9,8,0]
Shuffle array
[1,2,3,4,5,6,7,8,9,0].shuffle();
IMPORTANT: Alias of first
Get the first item
[1,2,3,4,5].start() // returns 1
Calculate the sum of values
[1,2,3,4].sum() // returns 10
IMPORTANT: Alias of right
Move item to right position by index
[1,2,3,4,5,6,7,8,9,0].down(0); // returns [1,2,3,4,5,6,7,8,9,0]
[1,2,3,4,5,6,7,8,9,0].down(9); // returns [1,2,3,4,5,6,7,9,8,0]
Get the first item
[1,2,3,4,5,6,7,8,9,0].first() // returns 1
Get the last item
[1,2,3,4,5,6,7,8,9,0].last() // returns 0
IMPORTANT: Alias of left
Move item to up position by index
[1,2,3,4,5,6,7,8,9,0].up(0); // returns [1,2,3,4,5,6,7,8,9,0]
[1,2,3,4,5,6,7,8,9,0].up(9); // returns [1,2,3,4,5,6,7,9,8,0]