ArrayArray diff Returns all items in the first array which are also in the second
*Array find Returns the first non undefined response If the response is (Boolean) True, then the value of that array item is returned instead...
ArrayPartition Partition an array into separate arrays
ArrayConverts an iterable value to an Array
ArrayUnique Filter an Array for unique values
objectExtend Object works like Object.assign(...) but recurses into the nested properties
objectExtend Object works like Object.assign(...) but recurses into the nested properties With Array Index will merge objects within an array, extend treats them as being different and merely pushes them on to end of array
objectFilter Object properties of falsy values, or apply a custom callback
booleanDetermines if the value is empty, accepts object and primitive types
booleanisSame compares two parameters to determine whether they have identical structures and values.
stringCapitalize Converts the first character of a sting to uppercase
objectJSONParse Wraps JSON.parse in a try/catch
functionArrayArray diff Returns all items in the first array which are also in the second
Kind: global function
Returns: Array - All items which are in both arrays
| Param | Type | Description |
|---|---|---|
| a | Array |
First array |
| b | Array |
Second array |
\*Array find Returns the first non undefined response If the response is (Boolean) True, then the value of that array item is returned instead…
Kind: global function
Returns: \* - returns the found item in the array if the callback returned true, or the response from the callback.
| Param | Type | Default | Description |
|---|---|---|---|
| arr | Array |
Array or iterable object to search | |
| callback | function |
callback to run tests on, return value other than undefined to stop searching | |
| thisArg | object |
|
Instance to execute the callback on |
ArrayPartition Partition an array into separate arrays
Kind: global function
Returns: Array - An array of arrays, unflattened
| Param | Type | Description |
|---|---|---|
| a | Array |
Array to filter |
| partitionIndexer | function |
Partition indexer hander, returns the index of where to put the new array. |
ArrayConverts an iterable value to an Array
Kind: global function
Returns: Array - The object as an array
| Param | Type | Description |
|---|---|---|
| obj | object |
Object to convert into an array |
ArrayUnique Filter an Array for unique values
Kind: global function
Returns: Array - A unique array
| Param | Type | Description |
|---|---|---|
| a | Array |
Array to filter |
objectExtend Object works like Object.assign(…) but recurses into the nested properties
Kind: global function
Returns: object - extended object
| Param | Type | Description |
|---|---|---|
| base | object |
an object to extend |
| …args | object |
a series of objects to extend |
objectExtend Object works like Object.assign(…) but recurses into the nested properties With Array Index will merge objects within an array, extend treats them as being different and merely pushes them on to end of array
Kind: global function
Returns: object - extended object
| Param | Type | Description |
|---|---|---|
| base | object |
an object to extend |
| …args | object |
a series of objects to extend |
objectFilter Object properties of falsy values, or apply a custom callback
Kind: global function
Returns: object - Filtered
| Param | Type | Description |
|---|---|---|
| data | object |
an object to filter |
| [callbackFilter] | function |
Function is a predicate, to test each element of the Object [default is not falsy]. Return true to keep the element, |
Example (filter out falsy values)
filter({a: 1, b: null, c: 0})
// {a: 1}
Example (filter out with callback)
filter({a: 1, b: null, c: 0}, (item) => item !== null)
// {a: 1, c: 0}
booleanDetermines if the value is empty, accepts object and primitive types
Kind: global function
Returns: boolean - Returns true is the object is falsy, or an empty object/array.
| Param | Type | Description |
|---|---|---|
| obj | \* |
value |
Example (Returns true for empty objects)
isEmpty(null)
isEmpty([])
isEmpty(0)
isEmpty({})
isEmpty('')
booleanisSame compares two parameters to determine whether they have identical structures and values.
Kind: global function
Returns: boolean - true if the two parameters have the same value
| Param | Type | Description |
|---|---|---|
| a | \* |
first parameter |
| b | \* |
second parameter |
Example (matches nested objects with same keys => values)
// returns true
isSame({a: {b: 1}}, {a: {b: 1}});
Example (does not match nested objects with same keys, but different values)
// returns false
isSame({a: {b: 1}}, {a: {b: 2}});
Example (does not match nested objects with additional properties)
// returns false
isSame({a: {b: 1}}, {a: {b: 1, c: 2}});
stringCapitalize Converts the first character of a sting to uppercase
Kind: global function
Returns: string - String with the first character made uppercase
| Param | Type | Description |
|---|---|---|
| str | string |
String to capitalize |
objectJSONParse Wraps JSON.parse in a try/catch
Kind: global function
Returns: object - JSON Object
| Param | Type | Description |
|---|---|---|
| str | string |
String to parse |
Example (JSONParse)
JSONParse(null)
// undefined
functionKind: global typedef
| Param | Type | Description |
|---|---|---|
| value | value |
item value |
| key | string |
item key |