MCPcopy Create free account
hub / github.com/blockstrap/framework / _fnExtend

Function _fnExtend

blockstrap/js/dependencies/tables.js:4891–4915  ·  view source on GitHub ↗

* Extend objects - very similar to jQuery.extend, but deep copy objects, and * shallow copy arrays. The reason we need to do this, is that we don't want to * deep copy array init values (such as aaSorting) since the dev wouldn't be * able to override them, but we do want to deep copy arrays.

( out, extender, breakRefs )

Source from the content-addressed store, hash-verified

4889 * @todo This doesn't take account of arrays inside the deep copied objects.
4890 */
4891 function _fnExtend( out, extender, breakRefs )
4892 {
4893 var val;
4894
4895 for ( var prop in extender ) {
4896 if ( extender.hasOwnProperty(prop) ) {
4897 val = extender[prop];
4898
4899 if ( $.isPlainObject( val ) ) {
4900 if ( ! $.isPlainObject( out[prop] ) ) {
4901 out[prop] = {};
4902 }
4903 $.extend( true, out[prop], val );
4904 }
4905 else if ( breakRefs && prop !== 'data' && prop !== 'aaData' && $.isArray(val) ) {
4906 out[prop] = val.slice();
4907 }
4908 else {
4909 out[prop] = val;
4910 }
4911 }
4912 }
4913
4914 return out;
4915 }
4916
4917
4918 /**

Callers 1

tables.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected