select-animation 1.1.4 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/select-animation.js +30 -1
package/package.json
CHANGED
package/select-animation.js
CHANGED
|
@@ -547,7 +547,7 @@
|
|
|
547
547
|
/**
|
|
548
548
|
* Utility for deep object copying
|
|
549
549
|
*/
|
|
550
|
-
function
|
|
550
|
+
function copyObject2(obj) {
|
|
551
551
|
if (obj === null || typeof obj !== "object") return obj;
|
|
552
552
|
if (Array.isArray(obj)) {
|
|
553
553
|
return obj.map(copyObject);
|
|
@@ -561,6 +561,35 @@
|
|
|
561
561
|
return copy;
|
|
562
562
|
}
|
|
563
563
|
|
|
564
|
+
function copyObject(obj) {
|
|
565
|
+
let retObj;
|
|
566
|
+
const _assignProps = function(o, key, target) {
|
|
567
|
+
let subType = Object.prototype.toString.call(o[key]);
|
|
568
|
+
if (subType === "[object Object]" || subType === "[object Array]") {
|
|
569
|
+
target[key] = b.copy(o[key]);
|
|
570
|
+
} else {
|
|
571
|
+
target[key] = o[key];
|
|
572
|
+
}
|
|
573
|
+
};
|
|
574
|
+
|
|
575
|
+
if (Object.prototype.toString.call(obj) === "[object Object]") {
|
|
576
|
+
retObj = {};
|
|
577
|
+
for (let key in obj) {
|
|
578
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
579
|
+
_assignProps(obj, key, retObj);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
} else if (Object.prototype.toString.call(obj) === "[object Array]") {
|
|
583
|
+
retObj = [];
|
|
584
|
+
for (let i = 0; i < obj.length; i++) {
|
|
585
|
+
_assignProps(obj, i, retObj);
|
|
586
|
+
}
|
|
587
|
+
} else {
|
|
588
|
+
retObj = obj;
|
|
589
|
+
}
|
|
590
|
+
return retObj;
|
|
591
|
+
};
|
|
592
|
+
|
|
564
593
|
/**
|
|
565
594
|
* Checks and binds events for pause/resume
|
|
566
595
|
*/
|