Skip to content

Instantly share code, notes, and snippets.

@jozsefDevs
Created October 22, 2013 20:17
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jozsefDevs/7107417 to your computer and use it in GitHub Desktop.
Save jozsefDevs/7107417 to your computer and use it in GitHub Desktop.
A simple way to implement a validation by JavaScript currying
var above = function(limit){
return function(value){
return value > limit;
};
};
var isAbove10 = above(10);
console.log(isAbove10(5)); // false
console.log(isAbove10(8)); // false
console.log(isAbove10(12)); // true
console.log(isAbove10(20)); // true
console.log(isAbove10(25)); // true
@Francisc
Copy link

Very nice.

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