1.3.2 • Published 2 years ago

validate-any v1.3.2

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
2 years ago

Validate Any

License Languages Top Language Commit Activity Last commit

Validate Any is a type validator mainly for Typescript (also works with Javascript) available here. Ever faced those issues where you're trying to make sure a type any is an instance of an interface? This is the issue this package was designed to solve. With this package, you can safely assert the type for an object and return customised errors if the types are incorrect.

Full Documentation is available here.

Motivation

I hate it when I am unable to validate the request types of JSON objects in Express requests. I wanted to be able to reject a request before my request handlers used the request body. I also didn't like casting the type of the body in the request.

Features

  • validate function to validate the data type of a variable
  • Validate Any can read the function types of
    • Strings
    • Numbers
    • Booleans
    • Undefined
    • Null
    • Lists
    • Objects
    • Classes
  • Validate Any is built to automatically return you the typescript annotations generated by the schema you pass, in the data property
  • Detailed error messages to tell you where any validation errors occured
  • API Middleware to simplify its usage with Express or NextJS

Testing

Validate Any's individual validators are tested with Jest. To run the tests, run the command

$ npm run test

Built with

  • TypeScript
    • @types/jest
    • typescript
  • Jest
    • @babel/core
    • @babel/preset-env
    • @babel/preset-typescript
    • jest
  • Miscellaneous
    • vuepress
1.2.4

2 years ago

1.3.2

2 years ago

1.2.3

2 years ago

1.3.1

2 years ago

1.2.2

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.2.1

2 years ago

1.0.2

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago