@jsopen/objects 1.0.0 → 1.1.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/cjs/merge.js +3 -3
- package/esm/merge.js +3 -3
- package/package.json +1 -1
- package/types/merge.d.ts +1 -1
package/cjs/merge.js
CHANGED
|
@@ -97,7 +97,7 @@ for (i = 0; i < len; i++) {
|
|
|
97
97
|
/** ************* filter *****************/
|
|
98
98
|
if (options?.filter) {
|
|
99
99
|
scriptL1For.push(`
|
|
100
|
-
if (!filterCallback(key,
|
|
100
|
+
if (!filterCallback(key, source, target, curPath)) {
|
|
101
101
|
delete target[key];
|
|
102
102
|
continue;
|
|
103
103
|
}`);
|
|
@@ -107,7 +107,7 @@ if (!filterCallback(key, curPath, target, source)) {
|
|
|
107
107
|
scriptL1For.push(`
|
|
108
108
|
if (
|
|
109
109
|
Object.prototype.hasOwnProperty.call(target, key) &&
|
|
110
|
-
ignoreCallback(key,
|
|
110
|
+
ignoreCallback(key, source, target, curPath)
|
|
111
111
|
) continue;
|
|
112
112
|
`);
|
|
113
113
|
}
|
|
@@ -118,7 +118,7 @@ if (
|
|
|
118
118
|
if (options?.copyDescriptors) {
|
|
119
119
|
let scriptL2Descriptors = scriptL1For;
|
|
120
120
|
if (typeof options?.copyDescriptors === 'function') {
|
|
121
|
-
scriptL1For.push('if (copyDescriptorsCallback(key,
|
|
121
|
+
scriptL1For.push('if (copyDescriptorsCallback(key, source, target, curPath)) {');
|
|
122
122
|
scriptL2Descriptors = [];
|
|
123
123
|
scriptL1For.push(scriptL2Descriptors);
|
|
124
124
|
scriptL1For.push(`} else`);
|
package/esm/merge.js
CHANGED
|
@@ -93,7 +93,7 @@ for (i = 0; i < len; i++) {
|
|
|
93
93
|
/** ************* filter *****************/
|
|
94
94
|
if (options?.filter) {
|
|
95
95
|
scriptL1For.push(`
|
|
96
|
-
if (!filterCallback(key,
|
|
96
|
+
if (!filterCallback(key, source, target, curPath)) {
|
|
97
97
|
delete target[key];
|
|
98
98
|
continue;
|
|
99
99
|
}`);
|
|
@@ -103,7 +103,7 @@ if (!filterCallback(key, curPath, target, source)) {
|
|
|
103
103
|
scriptL1For.push(`
|
|
104
104
|
if (
|
|
105
105
|
Object.prototype.hasOwnProperty.call(target, key) &&
|
|
106
|
-
ignoreCallback(key,
|
|
106
|
+
ignoreCallback(key, source, target, curPath)
|
|
107
107
|
) continue;
|
|
108
108
|
`);
|
|
109
109
|
}
|
|
@@ -114,7 +114,7 @@ if (
|
|
|
114
114
|
if (options?.copyDescriptors) {
|
|
115
115
|
let scriptL2Descriptors = scriptL1For;
|
|
116
116
|
if (typeof options?.copyDescriptors === 'function') {
|
|
117
|
-
scriptL1For.push('if (copyDescriptorsCallback(key,
|
|
117
|
+
scriptL1For.push('if (copyDescriptorsCallback(key, source, target, curPath)) {');
|
|
118
118
|
scriptL2Descriptors = [];
|
|
119
119
|
scriptL1For.push(scriptL2Descriptors);
|
|
120
120
|
scriptL1For.push(`} else`);
|
package/package.json
CHANGED
package/types/merge.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare namespace merge {
|
|
2
|
-
type NodeCallback = (key: string | symbol,
|
|
2
|
+
type NodeCallback = (key: string | symbol, source: any, target: any, path: string) => boolean;
|
|
3
3
|
interface Options {
|
|
4
4
|
deep?: boolean | NodeCallback;
|
|
5
5
|
/**
|