select-animation 1.1.3 → 1.1.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "select-animation",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "High-performance JavaScript animation engine for organic & fluid motion",
5
5
  "main": "select-animation.js",
6
6
  "scripts": {
@@ -547,7 +547,7 @@
547
547
  /**
548
548
  * Utility for deep object copying
549
549
  */
550
- function copyObject(obj) {
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
  */