rpqbArrayList inherits from JavaScript Array, without overwriting or populate this class.
Install:
# npm install rpqbarraylist
usage
var rpqbArrayList = require('rpqbArrayList')
API:
-
get(index)
Returns an element by position:
var list = ;list;list; // 1list; // 2list == list0; // true
-
set(index, value)
Set an element by position
var list = ;list;list;list; // hellolist; // world
-
indexOf(value)
Get index of an Array by element or object
var list = ;if list = 12list; //0list; //1 or if list = "name":"john""name":"tom"list; // 0list; // 1
-
containsObject(element)
Check if an object is in the list
var list = ;var obj1 = "name":"john";var obj2 = "name":"tom";var obj3 = "name":"potter";list;list;list;list; // truelist; // truelist; // truelist; // false
-
add(elements)
-
contains(element)
Check if an element is in the list
var list = ;list;list); // truelist); // truelist); // truelist); // false
-
add(elements)
Add elements to the list
var list = ;list;list;list;listlength; // 5
-
isEmpty()
Check if the list contains no elements
var list = ;list; // truelist;list; // false
-
equals(list)
Check if two lists are equals
var list = ;var list2 = ;list;list; // falselist2;list; // true
-
clone()
Creates a copy of the list
var list = ;list;var list2 = list;list; // true
-
remove(index)
Removes an element by position
var list = ;list;list;list; // [2, 3]
-
removeElement(element)
Removes a specified element
var list = ;list;list;list; // [1, 3]
-
removeAll(list)
Remove all the elements in another collection
var list = ;var list2 = ;list;list2;list;list; // [2, 4]
-
replaceAll(list)
Replace all the elements of the list
var list = ;var list2 = ;list;list2;list;list; // [1, 3, 5]
-
clear()
Remove all the elements in the list
var list = ;list;listclear;list; // true
-
toArray()
Return a new array with all the elements in the same order
var list = ;list;list; // [1, 2, 3]
-
first([n])
Returns the first element of the list. [see]
var list = ;list;list; // 1list; // [1, 2]
-
initial([n])
Returns everything but the last entry of the list. [see]
var list = ;list;list; // [1, 2, 3, 4]
-
last([n])
Returns the last element of the list. [see]
var list = ;list;list; // 3
-
rest(index)
Returns the rest of the elements in the list. [see]
var list = ;list;list; // [1, 2, 3, 4]
-
compact()
Returns a new list with the false values removed. [see]
var list = ;list;listcompact; // [1, 5]
-
flatten()
Returns a new list flattened. [see]
var list = ;list;list; // [1, 2, 3]
-
*without(values)
Returns a new list without the specified values. [see]
var list = ;list;list; // [2, 4]
-
partition(predicate)
Split the list into two lists. [see]
var list = ;list;list; // [[1, 3], [2, 4]]
-
*union(lists)
Returns the list joined with the arrays specified, the join is unique. [see]
var list = ;var list2 = ;list;list2;list; // [1, 2, 3, 4, 5]
-
*intersection(lists)
Returns the list intercepted with the arrays specified, the intersection is unique. [see]
var list = ;var list2 = ;list;list2;list; // [1, 2]
-
*difference(lists)
Returns the list minus the lists specified, the difference is unique. [see]
var list = ;var list2 = ;list;list2;list; // [2, 4]
-
unique()
Returns a list with the duplicated values removed. [see]
var list = ;list;list; // [1, 2, 3, 4]
-
uniq()
Alias for unique.
-
*zip(lists)
Merges together the values of each of the lists with the values at the corresponding position. [see]
-
object([values])
Converts lists into objects. [see]
-
sortedIndex(value, [iterator], [context])
Returns the index at which the value should be inserted into the list. [see]
var list = ;list;list; // 2
-
each()
Alias for forEach.
-
map(iterator, [context])
Returns a new list with each value mapped through a transformation. [see]
var list = ;list;list; // [2, 4, 6]
-
reduce(iterator, memo, [context])
[see]
-
reduceRight(iterator, memo, [context])
[see]
-
find(predicate, [context])
Returns a new list with the occurrences that passes the test. [see]
var list = ;list;list; // [2, 4, 6]
-
findOne(predicate, [context])
Returns the first occurrence that passes the test. [see]
var list = ;list;list; // 2
-
where(properties)
[see]
-
findWhere(properties)
[see]
-
reject(predicate, [context])
Returns the values in list without the elements that the truth test passes. [see]
-
every([predicate], [context])
Returns true if all of the values in the list pass the predicate truth test. [see]
var list = ;list;list; // true
-
some([predicate], [context])
Returns true if any of the values in the list pass the predicate truth test. [see]
var list = ;list;list; // true
-
*invoke(methodName, arguments)
Calls the method on each value in the list. [see]
var list = ;list;
var list = ;list;list; // 5
-
min([iterator], [context])
Returns the minimum value in list. [see]
var list = ;list;list; // 1
-
sortBy(iterator, [context])
Returns a new list with the values sorted. [see]
-
groupBy(iterator, [context])
[see]
-
indexBy(iterator, [context])
[see]
-
countBy(iterator, [context])
[see]
-
shuffle()
Returns a shuffled copy of the list, using a version of the Fisher-Yates shuffle. [see]
var list = ;list;list; // [3, 1, 5, 4, 2]
-
sample([n])
Returns a random sample from the list. [see]
var list = ;list;list; // 4
-
size()
Returns the length of the list.
var list = ;list;listsize; // 5=======rpqbArrayList========= rpqbArrayList inherits from JavaScript Array without overwriting or populate this class ##Install: # npm install rpqbarraylist ##usage var rpqbArrayList = ## API: * **** Returns an element by position: ```jsvar list = new rpqbArrayList;list.add([1, 2, 3, 4, 5]);list.get(0); // 1list.get(1); // 2list.get(0) == list[0]; // true
-
set(index, value)
Set an element by position
var list = ;list;list;list; // hellolist; // world
-
containsObject(element)
Check if an element is in the list
var list = ;var obj1 = "name":"john";var obj2 = "name":"tom";var obj3 = "name":"potter";list;list;list;list; // truelist; // truelist; // truelist; // false
-
add(elements)
-
contains(element)
Check if an element is in the list
var list = ;list;list); // truelist); // truelist); // truelist); // false
-
add(elements)
Add elements to the list
var list = ;list;list;list;listlength; // 5
-
isEmpty()
Check if the list contains no elements
var list = ;list; // truelist;list; // false
-
equals(list)
Check if two lists are equals
var list = ;var list2 = ;list;list; // falselist2;list; // true
-
clone()
Creates a copy of the list
var list = ;list;var list2 = list;list; // true
-
remove(index)
Removes an element by position
var list = ;list;list;list; // [2, 3]
-
removeElement(element)
Removes a specified element
var list = ;list;list;list; // [1, 3]
-
removeAll(list)
Remove all the elements in another collection
var list = ;var list2 = ;list;list2;list;list; // [2, 4]
-
replaceAll(list)
Replace all the elements of the list
var list = ;var list2 = ;list;list2;list;list; // [1, 3, 5]
-
clear()
Remove all the elements in the list
var list = ;list;listclear;list; // true
-
toArray()
Return a new array with all the elements in the same order
var list = ;list;list; // [1, 2, 3]
-
first([n])
Returns the first element of the list. [see]
var list = ;list;list; // 1list; // [1, 2]
-
initial([n])
Returns everything but the last entry of the list. [see]
var list = ;list;list; // [1, 2, 3, 4]
-
last([n])
Returns the last element of the list. [see]
var list = ;list;list; // 3
-
rest(index)
Returns the rest of the elements in the list. [see]
var list = ;list;list; // [1, 2, 3, 4]
-
compact()
Returns a new list with the false values removed. [see]
var list = ;list;listcompact; // [1, 5]
-
flatten()
Returns a new list flattened. [see]
var list = ;list;list; // [1, 2, 3]
-
*without(values)
Returns a new list without the specified values. [see]
var list = ;list;list; // [2, 4]
-
partition(predicate)
Split the list into two lists. [see]
var list = ;list;list; // [[1, 3], [2, 4]]
-
*union(lists)
Returns the list joined with the arrays specified, the join is unique. [see]
var list = ;var list2 = ;list;list2;list; // [1, 2, 3, 4, 5]
-
*intersection(lists)
Returns the list intercepted with the arrays specified, the intersection is unique. [see]
var list = ;var list2 = ;list;list2;list; // [1, 2]
-
*difference(lists)
Returns the list minus the lists specified, the difference is unique. [see]
var list = ;var list2 = ;list;list2;list; // [2, 4]
-
unique()
Returns a list with the duplicated values removed. [see]
var list = ;list;list; // [1, 2, 3, 4]
-
uniq()
Alias for unique.
-
*zip(lists)
Merges together the values of each of the lists with the values at the corresponding position. [see]
-
object([values])
Converts lists into objects. [see]
-
sortedIndex(value, [iterator], [context])
Returns the index at which the value should be inserted into the list. [see]
var list = ;list;list; // 2
-
each()
Alias for forEach.
-
map(iterator, [context])
Returns a new list with each value mapped through a transformation. [see]
var list = ;list;list; // [2, 4, 6]
-
reduce(iterator, memo, [context])
[see]
-
reduceRight(iterator, memo, [context])
[see]
-
find(predicate, [context])
Returns a new list with the occurrences that passes the test. [see]
var list = ;list;list; // [2, 4, 6]
-
findOne(predicate, [context])
Returns the first occurrence that passes the test. [see]
var list = ;list;list; // 2
-
where(properties)
[see]
-
findWhere(properties)
[see]
-
reject(predicate, [context])
Returns the values in list without the elements that the truth test passes. [see]
-
every([predicate], [context])
Returns true if all of the values in the list pass the predicate truth test. [see]
var list = ;list;list; // true
-
some([predicate], [context])
Returns true if any of the values in the list pass the predicate truth test. [see]
var list = ;list;list; // true
-
*invoke(methodName, arguments)
Calls the method on each value in the list. [see]
var list = ;list;
var list = ;list;list; // 5
-
min([iterator], [context])
Returns the minimum value in list. [see]
var list = ;list;list; // 1
-
sortBy(iterator, [context])
Returns a new list with the values sorted. [see]
-
groupBy(iterator, [context])
[see]
-
indexBy(iterator, [context])
[see]
-
countBy(iterator, [context])
[see]
-
shuffle()
Returns a shuffled copy of the list, using a version of the Fisher-Yates shuffle. [see]
var list = ;list;list; // [3, 1, 5, 4, 2]
-
sample([n])
Returns a random sample from the list. [see]
var list = ;list;list; // 4
-
size()
Returns the length of the list.
var list = ;list;listsize; // 5