Function
Static Public Summary | ||
public |
simpleDeepAssign(target: Object, source: Object, rest: ...Object) Recursively copy the values of all enumerable own properties from a source item or more to a target item if the both items are objects |
Static Private Summary | ||
private |
deepAssign(target: Object, source: Object) Recursively copy the values of all enumerable own properties from a source item to a target item if the both items are objects |
|
private |
deepAssignObject(target: Object, source: Object) Recursively copy the values of all enumerable own properties from a source object to a target object |
|
private |
isArray(item: *): boolean Check if it is an array |
|
private |
isObject(item: *): boolean Check if it is an object |
Static Public
public simpleDeepAssign(target: Object, source: Object, rest: ...Object) source
import simpleDeepAssign from 'simple-deep-assign/simple-deep-assign/index.js'
Recursively copy the values of all enumerable own properties from a source item or more to a target item if the both items are objects
Params:
Name | Type | Attribute | Description |
target | Object | a target object |
|
source | Object | a source object |
|
rest | ...Object |
|
the rest of source objects |
Example:
simpleDeepAssign({ a: 'a' }, { b: 'b' }, { c: [ 1, 2 ] }, { d: { a: 'a' } }, { d: { b: 'b' } });
// { a: 'a', b: 'b', c: [ 1, 2 ], d: { a: 'a', b: 'b' } }
Static Private
private deepAssign(target: Object, source: Object) source
import {deepAssign} from 'simple-deep-assign/simple-deep-assign/simpleDeepAssign.js'
Recursively copy the values of all enumerable own properties from a source item to a target item if the both items are objects
Params:
Name | Type | Attribute | Description |
target | Object | a target object |
|
source | Object | a source object |
Example:
deepAssign({ a: 'a', b: 'b' }, { b: 'B', c: 'c' });
// { a: 'a', b: 'B', c: 'c' }
private deepAssignObject(target: Object, source: Object) source
import {deepAssignObject} from 'simple-deep-assign/simple-deep-assign/simpleDeepAssign.js'
Recursively copy the values of all enumerable own properties from a source object to a target object
Params:
Name | Type | Attribute | Description |
target | Object | a target object |
|
source | Object | a source object |
Example:
deepAssignObject({ a: 'a', b: 'b' }, { b: 'B', c: 'c' });
// { a: 'a', b: 'B', c: 'c' }
private isArray(item: *): boolean source
import {isArray} from 'simple-deep-assign/simple-deep-assign/simpleDeepAssign.js'
Check if it is an array
Params:
Name | Type | Attribute | Description |
item | * | an item to check |
Return:
boolean | array or not |
Example:
isArray([0, 1, 2]) // true
private isObject(item: *): boolean source
import {isObject} from 'simple-deep-assign/simple-deep-assign/simpleDeepAssign.js'
Check if it is an object
Params:
Name | Type | Attribute | Description |
item | * | an item to check |
Return:
boolean | object or not |
Example:
isObject({ a: 'a' }) // true