@stemy/backend 4.0.2 → 4.0.4
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/esm2020/services/fixtures.mjs +1 -1
- package/esm2020/utils.mjs +16 -14
- package/fesm2015/stemy-backend.mjs +15 -13
- package/fesm2015/stemy-backend.mjs.map +1 -1
- package/fesm2020/stemy-backend.mjs +15 -13
- package/fesm2020/stemy-backend.mjs.map +1 -1
- package/package.json +1 -1
- package/services/fixtures.d.ts +1 -1
|
@@ -622,10 +622,23 @@ 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
|
+
// If object defines __shouldCopy as false, then don't copy it
|
|
637
|
+
if (source.__shouldCopy === false)
|
|
638
|
+
return source;
|
|
639
|
+
// Copy object
|
|
625
640
|
const shouldCopy = isFunction(source.__shouldCopy) ? source.__shouldCopy : () => true;
|
|
626
641
|
if (isConstructor(source.constructor)) {
|
|
627
|
-
if (source.__shouldCopy === false)
|
|
628
|
-
return source;
|
|
629
642
|
if (!target) {
|
|
630
643
|
try {
|
|
631
644
|
target = new source.constructor();
|
|
@@ -639,17 +652,6 @@ function copyRecursive(target, source, predicate) {
|
|
|
639
652
|
else {
|
|
640
653
|
target = Object.assign({}, target || {});
|
|
641
654
|
}
|
|
642
|
-
// Copy map entries
|
|
643
|
-
if (target instanceof Map) {
|
|
644
|
-
if (source instanceof Map) {
|
|
645
|
-
for (let [key, value] of source.entries()) {
|
|
646
|
-
if (!predicate(value, key, target, source))
|
|
647
|
-
continue;
|
|
648
|
-
target.set(key, !shouldCopy(key, value) ? value : copyRecursive(target.get(key), value, predicate));
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
return target;
|
|
652
|
-
}
|
|
653
655
|
// Copy object members
|
|
654
656
|
let keys = Object.keys(source);
|
|
655
657
|
target = keys.reduce((result, key) => {
|