@omegup/msync 0.0.82 → 0.0.84
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/index.esm.js +8 -8
- package/index.js +8 -8
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -258,8 +258,10 @@ const $pushDict = (key, value) => $accumulator(function () {
|
|
|
258
258
|
], function (ra, k, v, old) {
|
|
259
259
|
let a = { ...ra };
|
|
260
260
|
const equal = (a, b) => {
|
|
261
|
-
if (
|
|
261
|
+
if (!a || !b)
|
|
262
262
|
return a === b;
|
|
263
|
+
if ([a, b].some(a => Object.getPrototypeOf(a) != Object.prototype))
|
|
264
|
+
return a.valueOf() === b.valueOf();
|
|
263
265
|
const keys = Object.keys(a);
|
|
264
266
|
return keys.length === Object.keys(b).length && keys.every(k => equal(a[k], b[k]));
|
|
265
267
|
};
|
|
@@ -646,13 +648,13 @@ const $setEach1 = (updater, dict) => {
|
|
|
646
648
|
return $set1(set()(mapExact1(dict, updater)));
|
|
647
649
|
};
|
|
648
650
|
const $setEach = (updater, dict) => $setEach1(updater, dict)(root);
|
|
649
|
-
const $
|
|
650
|
-
const t = deltaExpr(expr);
|
|
651
|
+
const $replaceWithEach1 = (t) => {
|
|
651
652
|
return $setEach(k => to(t(k)), {
|
|
652
653
|
after: ['after', 'after'],
|
|
653
654
|
before: ['before', 'before'],
|
|
654
655
|
});
|
|
655
656
|
};
|
|
657
|
+
const $replaceWithEach = (expr) => $replaceWithEach1(deltaExpr(expr));
|
|
656
658
|
|
|
657
659
|
const $replaceWithDelta = (expr) => $replaceWithEach((field) => sub(expr, root().of(field)));
|
|
658
660
|
const $setDelta = (updater) => {
|
|
@@ -1120,11 +1122,9 @@ const $lookupDelta = ({ field1, field2 }, { coll, exec, input }, k1, k2, k, incl
|
|
|
1120
1122
|
return ite(eq(root().of(f).expr())(nil), nil, field(omit.backward(mergeExpr(omit.forward(map1(k2, a)), map1(k1, part.of(k1).expr())))));
|
|
1121
1123
|
}))
|
|
1122
1124
|
.with(includeNull1 === null
|
|
1123
|
-
? $
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
.of(k2)
|
|
1127
|
-
.expr())), map1(k1, nil)))));
|
|
1125
|
+
? $replaceWithEach1((f) => {
|
|
1126
|
+
const otherField = root().of(f === 'after' ? 'before' : 'after');
|
|
1127
|
+
return $ifNull(root().of(f).expr(), field(omit.backward(mergeExpr(omit.forward(map1(k2, otherField.of(k2).expr())), map1(k1, nil)))));
|
|
1128
1128
|
})
|
|
1129
1129
|
: link().stages)
|
|
1130
1130
|
.with($unwindDelta(k1, k2, k, undefined, includeNull1, includeNull2)).stages;
|
package/index.js
CHANGED
|
@@ -260,8 +260,10 @@ const $pushDict = (key, value) => $accumulator(function () {
|
|
|
260
260
|
], function (ra, k, v, old) {
|
|
261
261
|
let a = { ...ra };
|
|
262
262
|
const equal = (a, b) => {
|
|
263
|
-
if (
|
|
263
|
+
if (!a || !b)
|
|
264
264
|
return a === b;
|
|
265
|
+
if ([a, b].some(a => Object.getPrototypeOf(a) != Object.prototype))
|
|
266
|
+
return a.valueOf() === b.valueOf();
|
|
265
267
|
const keys = Object.keys(a);
|
|
266
268
|
return keys.length === Object.keys(b).length && keys.every(k => equal(a[k], b[k]));
|
|
267
269
|
};
|
|
@@ -648,13 +650,13 @@ const $setEach1 = (updater, dict) => {
|
|
|
648
650
|
return $set1(set()(mapExact1(dict, updater)));
|
|
649
651
|
};
|
|
650
652
|
const $setEach = (updater, dict) => $setEach1(updater, dict)(root);
|
|
651
|
-
const $
|
|
652
|
-
const t = deltaExpr(expr);
|
|
653
|
+
const $replaceWithEach1 = (t) => {
|
|
653
654
|
return $setEach(k => to(t(k)), {
|
|
654
655
|
after: ['after', 'after'],
|
|
655
656
|
before: ['before', 'before'],
|
|
656
657
|
});
|
|
657
658
|
};
|
|
659
|
+
const $replaceWithEach = (expr) => $replaceWithEach1(deltaExpr(expr));
|
|
658
660
|
|
|
659
661
|
const $replaceWithDelta = (expr) => $replaceWithEach((field) => sub(expr, root().of(field)));
|
|
660
662
|
const $setDelta = (updater) => {
|
|
@@ -1122,11 +1124,9 @@ const $lookupDelta = ({ field1, field2 }, { coll, exec, input }, k1, k2, k, incl
|
|
|
1122
1124
|
return ite(eq(root().of(f).expr())(nil), nil, field(omit.backward(mergeExpr(omit.forward(map1(k2, a)), map1(k1, part.of(k1).expr())))));
|
|
1123
1125
|
}))
|
|
1124
1126
|
.with(includeNull1 === null
|
|
1125
|
-
? $
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
.of(k2)
|
|
1129
|
-
.expr())), map1(k1, nil)))));
|
|
1127
|
+
? $replaceWithEach1((f) => {
|
|
1128
|
+
const otherField = root().of(f === 'after' ? 'before' : 'after');
|
|
1129
|
+
return $ifNull(root().of(f).expr(), field(omit.backward(mergeExpr(omit.forward(map1(k2, otherField.of(k2).expr())), map1(k1, nil)))));
|
|
1130
1130
|
})
|
|
1131
1131
|
: link().stages)
|
|
1132
1132
|
.with($unwindDelta(k1, k2, k, undefined, includeNull1, includeNull2)).stages;
|