Files
pjax/lib/util/clone.js
Behind The Math c13149626b Prettier fixes
2019-03-03 01:37:45 -05:00

14 lines
281 B
JavaScript

module.exports = function(obj) {
/* istanbul ignore if */
if (null === obj || "object" !== typeof obj) {
return obj;
}
var copy = obj.constructor();
for (var attr in obj) {
if (obj.hasOwnProperty(attr)) {
copy[attr] = obj[attr];
}
}
return copy;
};