mol_regexp 0.0.1454 → 0.0.1456
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
|
@@ -1956,18 +1956,42 @@ var $;
|
|
|
1956
1956
|
factories.set(val, make);
|
|
1957
1957
|
return make;
|
|
1958
1958
|
}
|
|
1959
|
+
const getters = new WeakMap();
|
|
1960
|
+
function get_prop(host, field) {
|
|
1961
|
+
let props = getters.get(host);
|
|
1962
|
+
let get_val = props?.[field];
|
|
1963
|
+
if (get_val)
|
|
1964
|
+
return get_val;
|
|
1965
|
+
get_val = (next) => {
|
|
1966
|
+
if (next !== undefined)
|
|
1967
|
+
host[field] = next;
|
|
1968
|
+
return host[field];
|
|
1969
|
+
};
|
|
1970
|
+
Object.defineProperty(get_val, 'name', { value: field });
|
|
1971
|
+
if (!props) {
|
|
1972
|
+
props = {};
|
|
1973
|
+
getters.set(host, props);
|
|
1974
|
+
}
|
|
1975
|
+
props[field] = get_val;
|
|
1976
|
+
return get_val;
|
|
1977
|
+
}
|
|
1959
1978
|
function $mol_wire_sync(obj) {
|
|
1960
1979
|
return new Proxy(obj, {
|
|
1961
1980
|
get(obj, field) {
|
|
1962
1981
|
let val = obj[field];
|
|
1982
|
+
const temp = $mol_wire_task.getter(typeof val === 'function' ? val : get_prop(obj, field));
|
|
1963
1983
|
if (typeof val !== 'function')
|
|
1964
|
-
return
|
|
1965
|
-
const temp = $mol_wire_task.getter(val);
|
|
1984
|
+
return temp(obj, []).sync();
|
|
1966
1985
|
return function $mol_wire_sync(...args) {
|
|
1967
1986
|
const fiber = temp(obj, args);
|
|
1968
1987
|
return fiber.sync();
|
|
1969
1988
|
};
|
|
1970
1989
|
},
|
|
1990
|
+
set(obj, field, next) {
|
|
1991
|
+
const temp = $mol_wire_task.getter(get_prop(obj, field));
|
|
1992
|
+
temp(obj, [next]).sync();
|
|
1993
|
+
return true;
|
|
1994
|
+
},
|
|
1971
1995
|
construct(obj, args) {
|
|
1972
1996
|
const temp = $mol_wire_task.getter(factory(obj));
|
|
1973
1997
|
return temp(obj, args).sync();
|