Skip to content

Instantly share code, notes, and snippets.

@allouis
Last active August 29, 2015 14:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allouis/87be8d2a9231b4da5178 to your computer and use it in GitHub Desktop.
Save allouis/87be8d2a9231b4da5178 to your computer and use it in GitHub Desktop.
_ wildcard in JavaScript
var _ = new Proxy({}, {
get: function get(target, property) {
return function f(x) {
return x[property]();
}
}
});
["some", "words"].map(_.toUpperCase); // => ["SOME", "WORDS"];
@benji6
Copy link

benji6 commented Aug 17, 2015

const _ = new Proxy({}, {get: (target, property) => x => x[property]()});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment