- diff(a, b) ⇒
Array Array diff Returns all items in the first array which are also in the second
- find(arr, callback, thisArg) ⇒
* Array find Returns the first non undefined response If the response is (Boolean) True, then the value of that array item is returned instead...
- partition(a, partitionIndexer) ⇒
Array Partition Partition an array into separate arrays
- toArray(obj) ⇒
Array Converts an iterable value to an Array
- unique(a) ⇒
Array Unique Filter an Array for unique values
- extend(base, ...args) ⇒
object Extend Object works like Object.assign(...) but recurses into the nested properties
- extendWithArrayIndex(base, ...args) ⇒
object Extend 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
- filter(data, [callbackFilter]) ⇒
object Filter Object properties of falsy values, or apply a custom callback
- isEmpty(obj) ⇒
boolean Determines if the value is empty, accepts object and primitive types
- isSame(a, b) ⇒
boolean isSame compares two parameters to determine whether they have identical structures and values.
- capitalize(str) ⇒
string Capitalize Converts the first character of a sting to uppercase
- JSONParse(str) ⇒
object JSONParse Wraps JSON.parse in a try/catch
- callbackFilter :
function
Array 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 |
Partition 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. |
Converts 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 |
Unique Filter an Array for unique values
Kind: global function
Returns: Array - A unique array
| Param | Type | Description |
|---|---|---|
| a | Array |
Array to filter |
Extend 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 |
Extend 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 |
Filter 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}Determines 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('')isSame 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}});Capitalize 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 |
JSONParse 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)
// undefinedKind: global typedef
| Param | Type | Description |
|---|---|---|
| value | value |
item value |
| key | string |
item key |