Methods
ish.extend(vMaxDepthopt, vTarget, vSource) → {object|function}
Merges the content of the passed objects into the passed target, adding or overriding properties within the target.
Example
Right-most source object wins:
var oResult = ish.extend({}, { i: 1 }, { i: 2 }); // `oResult.i` will equal `2`.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
vMaxDepth |
boolean | integer |
<optional> |
true
|
Value representing if a deep copy is to occur. false /1 performs a shallow copy, a positive integer indicates the max depth to perform a deep copy to, true and all other integer values perform a deep copy to an unlimited depth. |
vTarget |
object | function | Value representing the target object to receive properties. | ||
vSource |
object | function | Value(s) representing the source object(s) whose properties will be copied into the target. |
Returns:
Type | Description |
---|---|
object | function | Value representing the passed target. |
ish.resolve(returnMetadataopt, bForceCreateopt, oObject, vPath, vValueopt) → {variant}
Provides access to (and optionally creates) an object structure's nested properties.
Example
When forcing the creation of an object structure, data can be lost if an existing non-object property is used as a parent.
This will overwrite the boolean property nick
with an object reference containing the property campbell
.
var neek = { nick: true };
var deepProp = ish.resolve(true, neek, "nick.campbell");
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
returnMetadata |
Symbol |
<optional> |
!ish.resolve.returnMetadata
|
Value representing if metadata is to be returned; { value: {variant}, created: {boolean}, existed: {boolean} } . |
bForceCreate |
boolean |
<optional> |
true
|
Value representing if the path is to be created if it doesn't already exist. true creates the path if it does not already exist. |
oObject |
object | Value to interrogate. | ||
vPath |
string | Array.<string> | Value representing the path to the requested property as a period-delimited string (e.g. "parent.child.array.0.key") or an array of strings. | ||
vValue |
variant |
<optional> |
Value representing the value to set the referenced property to. |
Returns:
Type | Description |
---|---|
variant | Value representing the variant at the referenced path. |