2014-05-04 08:33:59 +02:00
|
|
|
module.exports = function(obj) {
|
2018-04-09 23:36:32 -04:00
|
|
|
/* istanbul ignore if */
|
2018-02-02 09:52:44 -05:00
|
|
|
if (null === obj || "object" !== typeof obj) {
|
2019-03-03 01:37:45 -05:00
|
|
|
return obj;
|
2014-05-04 08:33:59 +02:00
|
|
|
}
|
2019-03-03 01:37:45 -05:00
|
|
|
var copy = obj.constructor();
|
2014-05-04 08:33:59 +02:00
|
|
|
for (var attr in obj) {
|
|
|
|
|
if (obj.hasOwnProperty(attr)) {
|
2019-03-03 01:37:45 -05:00
|
|
|
copy[attr] = obj[attr];
|
2014-05-04 08:33:59 +02:00
|
|
|
}
|
|
|
|
|
}
|
2019-03-03 01:37:45 -05:00
|
|
|
return copy;
|
|
|
|
|
};
|