mol_compare_deep 0.0.1192 → 0.0.1194
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/node.test.js +26 -2
- package/node.test.js.map +1 -1
- package/package.json +1 -1
package/node.test.js
CHANGED
|
@@ -2629,18 +2629,42 @@ var $;
|
|
|
2629
2629
|
factories.set(val, make);
|
|
2630
2630
|
return make;
|
|
2631
2631
|
}
|
|
2632
|
+
const getters = new WeakMap();
|
|
2633
|
+
function get_prop(host, field) {
|
|
2634
|
+
let props = getters.get(host);
|
|
2635
|
+
let get_val = props?.[field];
|
|
2636
|
+
if (get_val)
|
|
2637
|
+
return get_val;
|
|
2638
|
+
get_val = (next) => {
|
|
2639
|
+
if (next !== undefined)
|
|
2640
|
+
host[field] = next;
|
|
2641
|
+
return host[field];
|
|
2642
|
+
};
|
|
2643
|
+
Object.defineProperty(get_val, 'name', { value: field });
|
|
2644
|
+
if (!props) {
|
|
2645
|
+
props = {};
|
|
2646
|
+
getters.set(host, props);
|
|
2647
|
+
}
|
|
2648
|
+
props[field] = get_val;
|
|
2649
|
+
return get_val;
|
|
2650
|
+
}
|
|
2632
2651
|
function $mol_wire_sync(obj) {
|
|
2633
2652
|
return new Proxy(obj, {
|
|
2634
2653
|
get(obj, field) {
|
|
2635
2654
|
let val = obj[field];
|
|
2655
|
+
const temp = $mol_wire_task.getter(typeof val === 'function' ? val : get_prop(obj, field));
|
|
2636
2656
|
if (typeof val !== 'function')
|
|
2637
|
-
return
|
|
2638
|
-
const temp = $mol_wire_task.getter(val);
|
|
2657
|
+
return temp(obj, []).sync();
|
|
2639
2658
|
return function $mol_wire_sync(...args) {
|
|
2640
2659
|
const fiber = temp(obj, args);
|
|
2641
2660
|
return fiber.sync();
|
|
2642
2661
|
};
|
|
2643
2662
|
},
|
|
2663
|
+
set(obj, field, next) {
|
|
2664
|
+
const temp = $mol_wire_task.getter(get_prop(obj, field));
|
|
2665
|
+
temp(obj, [next]).sync();
|
|
2666
|
+
return true;
|
|
2667
|
+
},
|
|
2644
2668
|
construct(obj, args) {
|
|
2645
2669
|
const temp = $mol_wire_task.getter(factory(obj));
|
|
2646
2670
|
return temp(obj, args).sync();
|