ow

Function argument validation for humans

MIT License

Downloads
3.4M
Stars
3.8K
Committers
38

Bot releases are visible (Hide)

ow -

Published by sindresorhus over 4 years ago

  • Include the dev-only file in the package 64ab6b8

https://github.com/sindresorhus/ow/compare/v0.15.0...v0.15.1

ow -

Published by sindresorhus almost 5 years ago

  • Add proper not messages (#130) 5b74b14
  • Preserve argument error stack trace in the browser (#164) a58814c

https://github.com/sindresorhus/ow/compare/v0.14.0...v0.15.0

ow -

Published by sindresorhus almost 5 years ago

Breaking

  • Require Node.js 8 25be9db

Enhancements

  • Export shim if running on browser in production (#129) acc5c9b
    Note: If you intend on using ow for development purposes only, use require('ow/dev-only') instead of the usual import '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 production, which should result in a significantly lower bundle size.

https://github.com/sindresorhus/ow/compare/v0.13.2...v0.14.0

ow -

Published by sindresorhus over 5 years ago

  • Fix missing dependency for TypeScript users (#149) 3846bb2

https://github.com/sindresorhus/ow/compare/v0.13.1...v0.13.2

ow -

Published by SamVerschueren over 5 years ago

Fixes:

  • Fix type definition directory in package.json 3d19c6b

https://github.com/sindresorhus/ow/compare/v0.13.0...v0.13.1

ow -

Published by sindresorhus over 5 years ago

Enhancements:

  • Add support for a custom validation function (#137) 702c283
  • Add string.url predicate (#140) 0a0972c
  • Add number.oneOf predicate (#132) e4d581e
  • Use the package.json "browser" field to toggle Node.js-specific functionality (#145) 3c42d59

Fixes:

  • Handle missing object property in exactShape predicate (#142) 5421063
  • Only call captureStackTrace when possible (#141) e697ccd

https://github.com/sindresorhus/ow/compare/v0.12.0...v0.13.0

ow -

Published by sindresorhus over 5 years ago

  • Add object shape validators (#127) 87e4ec2
  • Improve custom require logic (#128) 8d04298

https://github.com/sindresorhus/ow/compare/v0.11.1...v0.12.0

ow -

Published by sindresorhus over 5 years ago

  • Check for optional first before running validator (#125) 3de78ad

https://github.com/sindresorhus/ow/compare/v0.11.0...v0.11.1

ow -

Published by sindresorhus over 5 years ago

Add support for optional predicates (#124) 44272ab 🎉

This means you can now validate the input if it exists and ignore it if it doesn't.

// This passes
ow(2, ow.optional.number);

// This passes too
ow(undefined, ow.optional.number);

// This fails
ow(true, ow.optional.number);

We chose to only allow undefined and not null as that's how default parameters work too.

https://github.com/sindresorhus/ow/compare/v0.10.0...v0.11.0

ow -

Published by sindresorhus almost 6 years ago

  • Only infer label when predicate fails (#119) 67a06cb
  • Add support for checking C style integer data types (#120) 410e567
ow -

Published by sindresorhus almost 6 years ago

  • Import the fs module only in Node.js environments (#117) d24f2ef
ow -

Published by sindresorhus almost 6 years ago

Breaking

Ow now infers the label automatically on Node.js. For browser usage, the .label() method is removed in favor of an optional second ow() argument. 7eb02af

If you only use Ow in Node.js, you can change it like this:

- ow(foo, ow.string.minLength(5).label('foo'));
+ ow(foo, ow.string.minLength(5));

If you need browser support, you can change it like this;

- ow(foo, ow.string.minLength(5).label('foo'));
+ ow(foo, 'foo', ow.string.minLength(5));

Other

  • Add support for signed numeric values in the string predicate (#112) 58033f9
Package Rankings
Top 0.84% on Npmjs.org
Badges
Extracted from project README
Coverage Status