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

ov

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ov

object validation made easy

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

ov logo

ov

ov is a object validation library which can be used in the browser or with nodejs

npm version license

Installation

$ npm install --save ov

Usage

NodeJS

import { ov, Model, Blueprint } from 'ov';

const a = {
  name: 'Sean_',
  age: 19,
};

const b = new Blueprint({
  name: new Model()
    .string()
    .max(25)
    .alphanumeric(),
  age: new Model()
    .number()
    .integer()
    .min(16),
});

console.log('Valid', ov.validate(a, b));

Output

Valid Result {
  valid: false,
  errors:
   [ ValidationError {
       message: '\'name\' can only contain a-z, A-Z and 0-9',
       path: 'name',
       value: 'Sean_',
       model: [StringModel],
       check: [Check] } ] }

Browser

index.html

<script src="./dist/ov.js"></script>

script.js

const { ov, Model, Blueprint } = OV;

const a = {
  name: 'Sean_',
  age: 19,
};

const b = new Blueprint({
  name: new Model()
    .string()
    .max(25)
    .alphanumeric(),
  age: new Model()
    .number()
    .integer()
    .min(16),
});

console.log('Valid', ov.validate(a, b));

Output

Valid Result {
  valid: false,
  errors:
   [ ValidationError {
       message: '\'name\' can only contain a-z, A-Z and 0-9',
       path: 'name',
       value: 'Sean_',
       model: [StringModel],
       check: [Check] } ] }

Keywords

object

FAQs

Package last updated on 23 Nov 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