New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

validate-any

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

validate-any

Data Validator

1.3.2
unpublished
latest
Source
npm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

validate

FAQs

Package last updated on 29 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts