UNPKG

apex4x

Version:

The Comprehensive ARIA Development Suite

34 lines 3.64 kB
�� Function: extend(boolIsDeep, Object1, Object2, Etc. ) Description: Extends an object by merging all subsequent object properties and methods into the first object. Returns: Target Object. Note: When boolIsDeep is set to true, deep recursion will parse all child object branches within each object to merge, otherwise only the first level is parsed. The first object is always the merge target, and all subsequent objects passed as additional arguments will be merged into the first object. Supported object types include those of type Object and Function. If only one object is passed to the extend() function, then all properties and methods within that object will be merged into the $A object to extend 4X. All properties and methods with the same name will be overwritten within the target object if present. The extend() function is originally derived from the same function within jQuery. Example: var object1 = {originProp: "originValue"}; var object2 = {newProp: "newValue"}; var object3 = {lastProp: "lastValue"}; // Perform a shallow merge from one object into another. $A.extend(object1, object2); // object1 is extended // Perform a deep merge from one object into another. // Applicable when an object includes child objects. $A.extend(true, object1, object2); // object1 is extended // Perform a consecutive shallow merge from multiple objects into the first. $A.extend(object1, object2, object3); // object1 is extended // Perform a consecutive deep merge from multiple objects into the first. $A.extend(true, object1, object2, object3); // object1 is extended // Perform a shallow merge into the $A object to extend 4X. $A.extend(object1); // $A is extended // Perform a deep merge into the $A object to extend 4X. $A.extend(true, object1); // $A is extended