Methods
# inner arrayPad(array, len) → {String}
Pads an array with zeros up to a specified length.
Parameters:
Name | Type | Description |
---|---|---|
array |
Array
|
The array |
len |
Number
|
The desired length of the array |
pad_array(array, len)
String
# inner arrayShuffle(array) → {String}
Shuffles the elements of an array randomly.
Parameters:
Name | Type | Description |
---|---|---|
array |
Array
|
The array |
shuffle_array(array)
String
# inner filterOnMaValue(array, max) → {String}
Filters an array to include only elements less than or equal to a specified maximum value.
Parameters:
Name | Type | Description |
---|---|---|
array |
Array
|
The array to filter |
max |
Number
|
The maximum cutoff value |
array.filter((i) => i <= max)
String
# inner getMaxValue(array) → {String}
Finds the maximum value in an array.
Parameters:
Name | Type | Description |
---|---|---|
array |
Array
|
The array to find max value of |
getMaxValue(array)
String
# inner joinArray(array, delimiter) → {String}
Joins elements of an array into a string using a specified delimiter.
Parameters:
Name | Type | Description |
---|---|---|
array |
Array
|
The array to convert to string |
delimiter |
String
|
The delimiter to use between values |
array.join(delimiter)
String
# inner pushIntoArray(array, value) → {String}
Pushes a value into an array.
Parameters:
Name | Type | Description |
---|---|---|
array |
Array
|
The array |
value |
Number
|
The value to push at the end |
array.push(value)
String
# inner removeDuplicates(array) → {String}
Removes duplicate elements from an array.
Parameters:
Name | Type | Description |
---|---|---|
array |
Array
|
The array to delete duplicates from |
- [...new Set(array)]
String
# inner splitData(array, axis, index) → {String}
Splits an array into two parts based on a specified index and axis.
Parameters:
Name | Type | Description |
---|---|---|
array |
Array
|
The array |
axis |
Number
|
0 for row split, 1 for column split |
index |
Number
|
The index to split at |
if axis is 0 then [array.slice(0, index), array.slice(index)] else [array.map((item) => item.slice(0, index))[0], array.map((item) => item.slice(index))[0]]
String