New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

oproba

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oproba

[![NPM](https://nodei.co/npm/oproba.png)](https://nodei.co/npm/oproba/)

latest
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

oproba

NPM

Build Status

A 'rediculously light-weight' extension of aproba for key-value object validation

const validate = require( "oproba" );
// 'validate' is instance of aproba

// Check that `options` object properties comply specified aproba schemas
validate.obj({ foo: "N", bar: "S|N" }, options );


// Validate a nested object
validate.obj({
  foo: {
    baz: {
      quiz: "S"
    }
  },
  bar: "S|N" }, options );

Optional properties (? directive)

validate.obj({ foo: "N?", bar: "S|N?" }, options );

Explanatory error messages

  validate.obj({
    foo: { bar: "S|Z" }
  }, {
    foo: { bar: 1 }
  });
// throws `Error: Invalid type in property #foo.bar: Expected string or null but got number`

Keywords

aproba

FAQs

Package last updated on 05 Dec 2018

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