Sha256: 63b9665a0afb7881f8a7c74e1b44818bde433397e956305ac2bdde5ecdbbe605
Contents?: true
Size: 869 Bytes
Versions: 33
Compression:
Stored size: 869 Bytes
Contents
# fp-and-or [](https://npmjs.org/package/fp-and-or) Simple `and` and `or` functional programming predicates. - `and(...fs): (...args): boolean` - Returns a predicate that returns true if **all** arguments are true or evaluate to true for the given input. - `or(...fs): (...args): boolean` - Returns a predicate that returns true if **at least one** argument is true or evaluates to true for the given input. A predicate is a function that returns a `boolean`, commonly used in `Array.prototype.filter`. e.g. ```js const isEven = n => n%2 === 0 const isPositive = n => n > 0 // un-fancy items.filter(x => isEven(x) || isPositive(x)) // fancy items.filter(or(isEven, isPositive)) ``` ## Install ```sh npm install --save fp-and-or ``` ## Usage ```js const { and, or } = require('fp-and-or') <%=usage%>
Version data entries
33 entries across 33 versions & 1 rubygems