https://github.com/transitive-bullshit/ow-lite
Lightweight replacement for the ow validation library meant for browser usage.
https://github.com/transitive-bullshit/ow-lite
ow type-checking validation
Last synced: 3 months ago
JSON representation
Lightweight replacement for the ow validation library meant for browser usage.
- Host: GitHub
- URL: https://github.com/transitive-bullshit/ow-lite
- Owner: transitive-bullshit
- Created: 2018-06-13T23:50:04.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-07-11T23:12:42.000Z (almost 5 years ago)
- Last Synced: 2024-10-20T01:08:35.844Z (7 months ago)
- Topics: ow, type-checking, validation
- Language: JavaScript
- Homepage:
- Size: 49.8 KB
- Stars: 3
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# ow-lite
> Lightweight replacement for the [ow](https://github.com/sindresorhus/ow) validation library meant for browser usage.
[](https://www.npmjs.com/package/ow-lite) [](https://travis-ci.com/transitive-bullshit/ow-lite) [](https://standardjs.com)
## Install
```bash
npm install --save ow-lite
```## Why
`ow-lite` supports the most practical `ow` usage and is **30x smaller**, which is really important for **browser usage**.
| Library | Size | Minified | GZip |
|:---------------|:----------|:---------|:--------|
| `[email protected]` | 119.61kb | 65.95kb | 17.58kb |
| `ow-lite` | 6kb | 2.2kb | 903b |`ow-lite` has the following drawbacks:
- less verbose error messages
- less support for uncommon types and predicate methods## Usage
You may use `ow-lite` as a mostly drop-in replacement for `ow`. It supports the following types:
- number
- string
- objectWebpack's [resolve.alias](https://webpack.js.org/configuration/resolve/#resolve-alias) is a solid option for replacing `ow` with `ow-lite` at build time. See also [ow-shim](https://github.com/transitive-bullshit/ow-shim) if you want to replace `ow` usage with noops in production.
## Related
- [ow](https://github.com/sindresorhus/ow) - Function argument validation for humans.
- [ow-shim](https://github.com/transitive-bullshit/ow-shim) - Drop-in replacement to make the ow validation library a noop in production.## License
MIT © [Travis Fischer](https://github.com/transitive-bullshit)