json-joy
Version:
Collection of libraries for building collaborative editing apps.
6 lines • 417 B
JavaScript
export const proxy = (fn, path = []) => new Proxy(() => { }, {
get: (target, prop, receiver) => (path.push(String(prop)), proxy(fn, path)),
apply: (target, thisArg, args) => fn(path, ...args),
});
export const proxy$ = (fn, sentinel, path = []) => new Proxy({}, { get: (t, prop, r) => (prop === sentinel ? fn(path) : (path.push(String(prop)), proxy$(fn, sentinel, path))) });
//# sourceMappingURL=proxy.js.map