Array Util
Functions
- index returns the first index of the array where the key of the element equals the value(arr, key, value, from)
- find returns the first element of the array where the key of the element equals the value(arr, key, value, from)
- replace returns the first index of the array where the key of the element equals the value after replacing it with elem(arr, key, value, elem, from)
- remove returns the first index of the array where the key of the element equals the value after removing it(arr, key, value, from)
- removeAll returns an array of all instances where the value was found after removing them from the original array(arr, key, value, from)
- findRemove returns the first instance where the value was found after removing them from the original array(arr, key, value, from)
- diff an object with added removed and same between the 2 arrays(sArr, nArr)
index returns the first index of the array where the key of the element equals the value(arr, key, value, from)
Kind: global function
| Param | Type | Description |
|---|---|---|
| arr | array | array of objects |
| key | string | the key of each object that will be compared |
| value | any | the value being looked for |
| from | number | the starting search index |
find returns the first element of the array where the key of the element equals the value(arr, key, value, from)
Kind: global function
| Param | Type | Description |
|---|---|---|
| arr | array | array of objects |
| key | string | the key of each object that will be compared |
| value | any | the value being looked for |
| from | number | the starting search index |
replace returns the first index of the array where the key of the element equals the value after replacing it with elem(arr, key, value, elem, from)
Kind: global function
| Param | Type | Description |
|---|---|---|
| arr | array | array of objects |
| key | string | the key of each object that will be compared |
| value | any | the value being looked for and replaced |
| elem | any | the value that will replace the value |
| from | number | the starting search index |
remove returns the first index of the array where the key of the element equals the value after removing it(arr, key, value, from)
Kind: global function
| Param | Type | Description |
|---|---|---|
| arr | array | array of objects |
| key | string | the key of each object that will be compared |
| value | any | the value being looked for and removed |
| from | number | the starting search index |
removeAll returns an array of all instances where the value was found after removing them from the original array(arr, key, value, from)
Kind: global function
| Param | Type | Description |
|---|---|---|
| arr | array | array of objects |
| key | string | the key of each object that will be compared |
| value | any | the value being looked for and removed |
| from | number | the starting search index |
findRemove returns the first instance where the value was found after removing them from the original array(arr, key, value, from)
Kind: global function
| Param | Type | Description |
|---|---|---|
| arr | array | array of objects |
| key | string | the key of each object that will be compared |
| value | any | the value being looked for and removed |
| from | number | the starting search index |
diff an object with added removed and same between the 2 arrays(sArr, nArr)
Kind: global function
| Param | Type | Description |
|---|---|---|
| sArr | array | if in sArr, but not in nArr will be in removed |
| nArr | array | if in nArr, but not in sArr, will be in added |
