Ow is a TypeScript-based JavaScript library for validating function arguments and other runtime values with expressive predicates. It complements static TypeScript checking by catching invalid data that reaches an application after compilation. Developers can validate strings, numbers, objects, arrays, and many other values through a readable chainable API. Built-in predicates cover common constraints, while custom validators can handle application-specific requirements. Failed checks produce descriptive errors intended to make debugging easier than relying on later runtime failures. Ow can also test values without throwing and includes TypeScript type guards that narrow unknown values after successful validation. It works in server, browser, and command-line environments and is aimed at focused runtime checks rather than large schema validation workloads.
Features
- Expressive chainable validation API
- Extensive built-in predicates
- Custom runtime validators
- Descriptive validation errors
- TypeScript type narrowing and guards
- Server, browser, and CLI compatibility