Namespace: object

object

Source:
index.js

Methods


<static> difference(base, object)

Deep diff between two object

Parameters:
Name Type Description
base Object

Object to be compared

object Object

Object compared

Source:
object/diff.js
Returns:

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

Type
Object

<static> get(collection, keyPath [, defaultValue])

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

Parameters:
Name Type Argument 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

Source:
object/get.js
Returns:
Type
*

<static> isPlainObject(any)

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

Parameters:
Name Type Description
any *
Source:
object/isPlainObject.js
See:

<static> objectToArray(object, keyNaming, valueNaming)

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

Parameters:
Name Type Description
object *
keyNaming *
valueNaming *
Source:
object/objectToArray.js
Returns:
Type
array

<static> pushIntoBucket(collection, key, value [, flattenArray])

Push an value into an array element of a collection

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

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

Source:
object/pushIntoBucket.js
Returns:

The modified bucket

Type
*

<static> remap(object, mapping, keepUnmapped)

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

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

Source:
object/remap.js
Returns:

Remapped object

Type
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

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

Source:
object/set.js
Returns:
Type
*

<static> take(object [, n])

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

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

The number of k-v pair to take.

Source:
object/take.js
Returns:
Type
Object