ow
ow copied to clipboard
Function argument validation for humans
In addition to validating values I want to identify and redact, remove, or otherwise scrub personally identifiable information (PII) from objects when logging. I can create my own object hierarchy...
Colleagues and I have been wanting to make validators to assert values to be of specific subtypes, e.g. a union of specific strings, and narrow the type accordingly. We've been...
I want to be able to validate that a value is one of several specific values and then get a union type returned e.g. ```ts ow.string.oneOf(["on", "off"] as const) ```...
Hi there, thanks for `ow`, looks like a super simple, minimal validator! In searching the repo for a way to get all of the errors out of `ow`, I found...
If we want to validate an object with optional parameters for a spread: ```ts type Hotdog = { length: number; topping: string; } function patchHotdog(hotdog: Hotdog, patchBody: unknown): Hotdog {...
Simple code: ```js ow([123], 'myValues', ow.array.ofType(ow.string)) ``` All of a sudden started giving me the following error message: ``` '(array `myValues`) Expected `e` to be of type `string` but received...
## Problem Use case: validating tagged json objects coming over the wire ```ts type Carrot = { type: 'carrot'; }; type Hotdog = { type: 'hotdog'; }; type Food =...
## What happens: ```js const ow = require('ow').default; ow({ foo: 'bar', bar: undefined }, ow.object.exactShape({ foo: ow.string, })); ``` Throws: ``` ArgumentError: Did not expect property `bar` to exist, got...
Hi guys, thanks for this amazing library! I wonder if there is a way how to extend predicates or compose a new one using a set of others. Here is...
When testing `NaN` against `ow.number`, the following error message is emitted: ``` ArgumentError: Expected argument to be of type `number` but received type `number` at ow (node_modules/ow/dist/index.js:29:28) { validationErrors: Map(1)...