{"repo":"sindresorhus/ow","free":true,"listed":false,"github":"https://github.com/sindresorhus/ow","clone":"git clone https://github.com/sindresorhus/ow.git","description":"Function argument validation for humans","language":"TypeScript","stars":3865,"topics":["validation","type-checking","nodejs","npm-package","javascript"],"license":"MIT","category":"databases-storage","readme_excerpt":"Function argument validation for humans Why use Ow? TypeScript only validates types at compile time. Once compiled, your program can still receive unexpected data at runtime from: - Function arguments receiving untrusted input - CLI arguments and flags - Environment variables and configuration files For complex schema validation (API responses, database queries, JSON parsing), use zod instead. Ow provides runtime validation that: - Catches errors early - Fail fast with descriptive error messages instead of cryptic runtime errors - Documents expectations - Make your code self-documenting by explicitly stating what you expect - Simplifies debugging - Spend less time tracking down type-related bugs in production - Works anywhere - Use the same validation on the server, in the browser, or in CLI tools - Provides type guards - Narrow TypeScript types for safer code after validation Highlights - Expressive chainable API - Lots of built-in validations - Supports custom validations - Automatic label inference in Node.js - Written in TypeScript Install Usage Practical Examples Function Arguments Configuration Validation Constructor Validation Utility Functions CLI Arguments [!NOTE] If you intend on using ow for development purposes only, use import ow from 'ow/dev-only' instead of the usual import ow from 'ow' , and run the bundler with NODE ENV set to production (e.g. $ NODE ENV=\"production\" parcel build index.js ). This will make ow automatically export a shim when running in produc","default_branch":null,"files":null,"tree":[],"storefront":"/r/sindresorhus","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/sindresorhus/ow/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}