Skip to content

Instantly share code, notes, and snippets.

@vlastachu
Created September 27, 2018 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vlastachu/27ec7fc5426ac28e3b0568618d02399a to your computer and use it in GitHub Desktop.
Save vlastachu/27ec7fc5426ac28e3b0568618d02399a to your computer and use it in GitHub Desktop.
var _ = new Proxy({}, {get: (object, prop) => x => Reflect.get(x, prop)})
// Now you can use `_.method` instead of `x => x.method`
var a = {someMethod: x => x + 1}
_.someMethod(a)(1) // => 2
a.prototype.prototypeMethod = (a, b) => a + b
_.prototypeMethod(a)(1, 2) // => 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment