Skip to content

Instantly share code, notes, and snippets.

@gskachkov
Created November 6, 2017 21:09
Show Gist options
  • Save gskachkov/a878fb79ed93d8c7f259814d70b84b1c to your computer and use it in GitHub Desktop.
Save gskachkov/a878fb79ed93d8c7f259814d70b84b1c to your computer and use it in GitHub Desktop.
const handler = {
get: function(target, property, receiver) {
if (property.startAt(0) === "_") return undefined;
return target[property];
}
};
const proxy = new Proxy({}, handler);
console.log(proxy.id); // 'ABCD'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment