@anyhowstep/data-validation

+ Type checks with enumerated error codes + String format type checks + Array type checks + Type guards (x is Type) + Type assertions (assert x is Type and return; otherwise, throw) + Customizable error messages (`ErrorMessageService.Map = /*Custom error

Stats

StarsIssuesVersionUpdatedCreatedSize
@anyhowstep/data-validation
1.15.04 years ago4 years agoMinified + gzip package size for @anyhowstep/data-validation in KB

Readme

Goals

  • Type checks with enumerated error codes
  • String format type checks
  • Array type checks
  • Type guards (x is Type)
  • Type assertions (assert x is Type and return; otherwise, throw)
  • Customizable error messages (ErrorMessageService.Map = /*Custom error code to error message format*/;)
  • Promise-based API available

Non-Goals

  • Performance is not a goal; we are stressing safety, and usability over performance.

Promise-based API

While all type guards, and domain checks are synchronous, a promise-based API may be desirable when wanting to validate a large number of conditions, and using a final catch() to handle errors.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.