Last active
February 11, 2019 22:26
-
-
Save Ginden/9854b91b968f3d9c5d42aa04051435a6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class FooArray extends Array { | |
constructor(...args) { | |
super(...args); | |
return new Proxy(this, { | |
defineProperty(target, property, descriptor) { | |
console.log({target, property, descriptor}); | |
return Reflect.defineProperty(target, property, descriptor); | |
} | |
}) | |
} | |
} | |
(new FooArray(1, 2, 3)).filter((val) => { | |
console.log(`predicate ${val}`); | |
return true; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment