Socket
Book a DemoInstallSign in
Socket

object-validate

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-validate

Validate an object based on a schema.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

object-validate

NPM version build status Test coverage Downloads

Validate an object based on a schema.

Installation

$ npm install object-validate

Usage

var validate = require('object-validate')

var schema = validate({
  username: (val) => 'string' == typeof val,
  age:      (val) => /(\n{1,2})/.test(val)
})

schema({ username: 'tobi', age: 100 })
// => { username: true, age: false }

Why?

Most data validation tools make assumptions about the type of data you'd want to test. By just using functions as validators we make no assumptions about your data which gives great flexibility.

See Also

License

MIT

Keywords

object

FAQs

Package last updated on 14 Dec 2014

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