This can lead to some pretty strange behaviour:
const ow = require('ow')
const array = ow.array
ow([1], array) // ok
ow([''], array.ofType(ow.string)) // ok
ow([1], array) // ArgumentError: (array) Expected `item` to be of type `string` but received type `number`
Many users won't hit this because ow.array
and all the other props return a new value every time they're accessed. This should probably be documented at a minimum, but I wondered if there'd be any interest in a refactor to make the Predicate
s and their validators
immutable, and replace addValidator
with withValidator
or similar which would return a new instance.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too