rewrite client

This commit is contained in:
Robert Soriano
2022-10-29 19:02:14 -07:00
parent b72b0449c1
commit 7257842438
8 changed files with 319 additions and 108 deletions

23
test.js Normal file
View File

@@ -0,0 +1,23 @@
const data = {
hello: {
log() {
return 'hello log';
},
},
hi: {
log() {
return 'hi log'
},
},
}
const blankObject = {};
const proxy = new Proxy(blankObject, {
get(target, key) {
if (key in data) return data[key]; // <---
return target[key]; // default
}
});
console.log(proxy.hello.log()); // hello log;