
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@vates/predicates
Advanced tools
Utilities to compose predicates
Installation of the npm package:
> npm install --save @vates/predicates
undefined predicates are ignored and undefined is returned if all predicates are undefined, this permits the most efficient composition:
const compositePredicate = not(every(undefined, some(not(predicate2), undefined)))
// ends up as
const compositePredicate = predicate2
Predicates can also be passed wrapped in an array:
const compositePredicate = every([predicate1, some([predicate2, predicate3])])
this and all arguments are passed to the nested predicates.
every(predicates)Returns a predicate that returns
trueiff every predicate returnstrue.
const isBetween3And7 = every(
n => n >= 3,
n => n <= 7
)
isBetween3And10(0)
// → false
isBetween3And10(5)
// → true
isBetween3And10(10)
// → false
not(predicate)Returns a predicate that returns the negation of the predicate.
const isEven = n => n % 2 === 0
const isOdd = not(isEven)
isOdd(1)
// true
isOdd(2)
// false
some(predicates)Returns a predicate that returns
trueiff some predicate returnstrue.
const isAliceOrBob = some(
name => name === 'Alice',
name => name === 'Bob'
)
isAliceOrBob('Alice')
// → true
isAliceOrBob('Bob')
// → true
isAliceOrBob('Oscar')
// → false
Contributions are very welcomed, either on the documentation or on the code.
You may:
FAQs
Utilities to compose predicates
We found that @vates/predicates demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.