Skip to content

Instantly share code, notes, and snippets.

@3rd-Eden
Last active June 28, 2017 11:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 3rd-Eden/cbc853c9ad7ca55668e8 to your computer and use it in GitHub Desktop.
Save 3rd-Eden/cbc853c9ad7ca55668e8 to your computer and use it in GitHub Desktop.
function Car() {
this.type = 'fo sho'
}
Object.defineProperty(Car.prototype, 'is', {
get: function getterson() {
var car = this;
function named(args) {
args = named.curry.concat(Array.prototype.slice.call(arguments, 0));
return args[0] === 'foo' && car.type === args[1];
}
named.curry = []
return named;
}
});
@3rd-Eden
Copy link
Author

var car = new Car();
var is = car.is;
is.curry.push('foo')

console.log(is('fo sho')) // true

@Swaagie
Copy link

Swaagie commented Jun 20, 2014

you cannot do car.is.bind(car, 'BMW')

@3rd-Eden
Copy link
Author

var car = new Car();
var is = car.is;
is.curry.push('foo', 'fo sho');

console.log(is()) // true

@usqr
Copy link

usqr commented Jun 28, 2017

This really should have more subscribers! xD

can you make that it would resolve
is.legen.dairy('milk', 'van') ?

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