-
-
Save zorgick/7256a59153cd5538aa8a305a17a45528 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Ω = new Proxy(new WeakMap, { | |
set (weakmap, reference, input) { | |
const invocable = eval(reference); | |
if (typeof invocable != 'function') return; | |
weakmap.set(invocable, | |
Array.isArray(input) | |
? invocable(...input) | |
: invocable(input) | |
); | |
}, | |
get (weakmap, reference) { | |
const invocable = eval(reference); | |
return weakmap.get(invocable); | |
}, | |
deleteProperty (weakmap, reference) { | |
const invocable = eval(reference); | |
weakmap.delete(invocable); | |
}, | |
has (weakmap, reference) { | |
const invocable = eval(reference); | |
return weakmap.has(invocable); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment