Last active
November 14, 2017 21:24
-
-
Save gskachkov/e549eefef5a0271d310ec2aa97b82460 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
const obj = {}; | |
const proxy = new Proxy(obj, { | |
set: function (target, prop, value) { | |
if (prop === "id" && value === undefined) | |
throw new Error("'undefined' is not allowed."); | |
Reflect.set(target, prop, value); | |
return true; | |
} | |
}); | |
proxy.id = "foo"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment