@stemy/backend 4.0.4 → 4.0.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.
@@ -622,17 +622,6 @@ function copyRecursive(target, source, predicate) {
622
622
  }
623
623
  if (isBuffer(source))
624
624
  return Buffer.from(source);
625
- // Copy map entries
626
- if (target instanceof Map) {
627
- if (source instanceof Map) {
628
- for (let [key, value] of source.entries()) {
629
- if (!predicate(value, key, target, source))
630
- continue;
631
- target.set(key, copyRecursive(target.get(key), value, predicate));
632
- }
633
- }
634
- return target;
635
- }
636
625
  // If object defines __shouldCopy as false, then don't copy it
637
626
  if (source.__shouldCopy === false)
638
627
  return source;
@@ -652,6 +641,17 @@ function copyRecursive(target, source, predicate) {
652
641
  else {
653
642
  target = Object.assign({}, target || {});
654
643
  }
644
+ // Copy map entries
645
+ if (target instanceof Map) {
646
+ if (source instanceof Map) {
647
+ for (let [key, value] of source.entries()) {
648
+ if (!predicate(value, key, target, source))
649
+ continue;
650
+ target.set(key, !shouldCopy(key, value) ? value : copyRecursive(target.get(key), value, predicate));
651
+ }
652
+ }
653
+ return target;
654
+ }
655
655
  // Copy object members
656
656
  let keys = Object.keys(source);
657
657
  target = keys.reduce((result, key) => {