org.hisrc.jsonix.Jsonix.Util.js Maven / Gradle / Ivy
Jsonix.Util = {};
Jsonix.Util.extend = function(destination, source) {
destination = destination || {};
if (source) {
/*jslint forin: true */
for ( var property in source) {
var value = source[property];
if (value !== undefined) {
destination[property] = value;
}
}
/**
* IE doesn't include the toString property when iterating over an
* object's properties with the for(property in object) syntax.
* Explicitly check if the source has its own toString property.
*/
/*
* FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
* prototype object" when calling hawOwnProperty if the source object is
* an instance of window.Event.
*/
// REWORK
// Node.js
sourceIsEvt = typeof window !== 'undefined' && window !== null && typeof window.Event === "function" && source instanceof window.Event;
if (!sourceIsEvt && source.hasOwnProperty && source.hasOwnProperty('toString')) {
destination.toString = source.toString;
}
}
return destination;
};
© 2015 - 2024 Weber Informatics LLC | Privacy Policy