operators "or" and "and"
lybo opened this issue · 1 comments
lybo commented
Regarding this article https://codepen.io/Universalist/post/predicates-in-javascript
You can include or and and predicates with multiple args
function or(...args) {
return function(x) {
return args.some(fn => fn(x));
}
}
function and(...args) {
return function(x) {
return args.every(fn => fn(x));
}
}
landau commented
Good idea! Implemented.
https://landau.github.io/predicate/#and
https://landau.github.io/predicate/#or
Released in version 1.1.0
. Use version 1.1.1
for a perf fix in chaining.
Thanks!