- Source:
- index.js
Methods
-
<static> difference(base, object)
-
Deep diff between two object
Parameters:
Name Type Description baseObject Object to be compared
objectObject 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/getParameters:
Name Type Argument Description collectionObject The collection
keyPathstring | array A dot-separated path (dsp) or a key array, e.g. settings.xxx.yyy, or ['setting', 'xxx', 'yyy']
defaultValueObject <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 lodashParameters:
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 collectionObject keystring valueObject flattenArrayboolean <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* mappingObject key to newKey or key to array[ newKey, valueMap ] for next level mapping
keepUnmappedboolean 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/setParameters:
Name Type Description collectionObject The collection
keyPathstring A dot-separated path (dsp) or a key array, e.g. settings.xxx.yyy, or ['setting', 'xxx', 'yyy']
valueObject 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 objectObject ninteger <optional>
1 The number of k-v pair to take.
- Source:
- object/take.js
Returns:
- Type
- Object