object

object

Source:

Methods

(static) difference(base, object) → {Object}

Deep diff between two object

Source:
Parameters:
Name Type Description
base Object

Object to be compared

object Object

Object compared

Returns:
Type:
Object

Return the key-value pair from object which of the value is different from base with the same key, or undefined if no difference

(static) get(collection, keyPath, defaultValueopt) → {*}

Get a value by dot-separated path or key array from a collection Does not support '[i]', e.g. 'a[0].b.c' style accessor, use [ 'a', 0, 'b', 'c' ] instead, different from lodash/get

Source:
Parameters:
Name Type Attributes Description
collection Object

The collection

keyPath string | array

A dot-separated path (dsp) or a key array, e.g. settings.xxx.yyy, or ['setting', 'xxx', 'yyy']

defaultValue Object <optional>

The default value if the path does not exist

Returns:
Type:
*

(static) get(collection, keyPath, getValueByopt, defaultValueopt) → {*}

Get a value by dot-separated path or key array from a collection Does not support '[i]', e.g. 'a[0].b.c' style accessor, use [ 'a', 0, 'b', 'c' ] instead, different from lodash/get

Source:
Parameters:
Name Type Attributes Description
collection Object

The collection

keyPath string | array

A dot-separated path (dsp) or a key array, e.g. settings.xxx.yyy, or ['setting', 'xxx', 'yyy']

getValueBy function <optional>

A function to get the value, e.g. (collection, key) => collection[key]

defaultValue Object <optional>

The default value if the path does not exist

Returns:
Type:
*

(static) isPlainObject(any)

Check a variable whether is plain object. 20x fasters than lodash

Source:
See:
Parameters:
Name Type Description
any *

(static) objectToArray(object, keyNaming, valueNaming) → {array}

Convert a k-v paired object into an array pair-by-pair.

Source:
Parameters:
Name Type Description
object *
keyNaming *
valueNaming *
Returns:
Type:
array

(static) pushIntoBucket(collection, key, value, flattenArrayopt) → {*}

Push an value into an array element of a collection

Source:
Parameters:
Name Type Attributes Default Description
collection Object
key string
value Object
flattenArray boolean <optional>
false

Whether to flatten the array, if the given value is an array.

Returns:
Type:
*

The modified bucket

(static) remap(object, mapping, keepUnmapped) → {Object}

Remap the keys of object elements in an array, like projection.

Source:
Parameters:
Name Type Description
object *
mapping Object

key to newKey or key to array[ newKey, valueMap ] for next level mapping

keepUnmapped boolean

If true, will keep those not in mapping as its original key, otherwise filter out

Returns:
Type:
Object

Remapped object

(static) set(collection, keyPath, value) → {*}

Set a value by dot-separated path or key array into a collection Does not support '[i]', e.g. 'a[0].b.c' style accessor, use [ 'a', 0, 'b', 'c' ] instead, different from lodash/set

Source:
Parameters:
Name Type Description
collection Object

The collection

keyPath string

A dot-separated path (dsp) or a key array, e.g. settings.xxx.yyy, or ['setting', 'xxx', 'yyy']

value Object

The default value if the path does not exist

Returns:
Type:
*

(static) take(object, nopt) → {Object}

Creates a new object with n k-v pairs taken from the beginning.

Source:
Parameters:
Name Type Attributes Default Description
object Object
n integer <optional>
1

The number of k-v pair to take.

Returns:
Type:
Object