@ztimson/utils 0.27.1 → 0.27.2

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/dist/index.cjs CHANGED
@@ -121,17 +121,9 @@ ${opts.message || this.desc}`;
121
121
  `;
122
122
  }
123
123
  }
124
- function applyDelta(base, deltas) {
125
- if (deltas === null) return null;
126
- if (typeof base !== "object" || base === null) return deltas === void 0 ? base : deltas;
127
- const result = Array.isArray(base) ? [...base] : { ...base };
128
- for (const key in deltas) {
129
- const val = deltas[key];
130
- if (val === void 0) delete result[key];
131
- else if (typeof val === "object" && val !== null && !Array.isArray(val)) result[key] = applyDelta(result[key], val);
132
- else result[key] = val;
133
- }
134
- return result;
124
+ function applyDeltas(base, ...deltas) {
125
+ for (let d of deltas) base = applyDeltas(base, d);
126
+ return base;
135
127
  }
136
128
  function calcDelta(old, updated) {
137
129
  if (updated == null) return null;
@@ -2367,7 +2359,7 @@ ${opts.message || this.desc}`;
2367
2359
  exports2.UnauthorizedError = UnauthorizedError;
2368
2360
  exports2.addUnique = addUnique;
2369
2361
  exports2.adjustedInterval = adjustedInterval;
2370
- exports2.applyDelta = applyDelta;
2362
+ exports2.applyDeltas = applyDeltas;
2371
2363
  exports2.arrayDiff = arrayDiff;
2372
2364
  exports2.calcDelta = calcDelta;
2373
2365
  exports2.camelCase = camelCase;