@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 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, curPath, target, source)) {
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, curPath, target, source)
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, curPath, target, source)) {');
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, curPath, target, source)) {
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, curPath, target, source)
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, curPath, target, source)) {');
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jsopen/objects",
3
3
  "description": "Helper utilities for working with JavaScript objects and arrays",
4
- "version": "1.0.0",
4
+ "version": "1.1.0",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
7
7
  "dependencies": {
package/types/merge.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export declare namespace merge {
2
- type NodeCallback = (key: string | symbol, path: string, target: any, source: any) => boolean;
2
+ type NodeCallback = (key: string | symbol, source: any, target: any, path: string) => boolean;
3
3
  interface Options {
4
4
  deep?: boolean | NodeCallback;
5
5
  /**