Created
October 11, 2022 11:28
-
-
Save victor141516/7234b2597df7ef0daca1c4ed9a2431f0 to your computer and use it in GitHub Desktop.
Recursive proxy for debugging purposes
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 a = (prefix = '') => | |
new Proxy( | |
{}, | |
{ | |
get(_, p) { | |
const newPrefix = [prefix.toString(), p.toString()].join('.'); | |
console.log('get: ', newPrefix); | |
return a(newPrefix); | |
}, | |
set(_, p, newValue) { | |
const newPrefix = [prefix.toString(), p.toString()].join('.'); | |
console.log('set:', newPrefix, newValue); | |
return true; | |
}, | |
}, | |
); | |
return a(); | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment