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

abides

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abides

elegant javascript object validation

latest
npmnpm
Version
1.1.2
Version published
Weekly downloads
43
1333.33%
Maintainers
1
Weekly downloads
 
Created
Source

the dude

Build Status codecov Maintainability

abides

modern javascript object validation.
validate, default and transform data.

not production ready yet, use at own risk.

  • lightweight (~1kb min+gzipped bundled)
  • only 3 deps (lodash, esm and fromentries polyfill)
  • non-obscure control of validation

example

import { abides, ofType, numberCoerce } from 'abides'

abides(5, ofType(Number))
// => { ok: true, errors: [], self: { error: '' }, result: 5 }
abides('5', ofType(Number))
/* => {
  ok: false,
  self: { error: 'is '5' but should be of type Number' },
  errors: ['is '5' but should be of type Number'],
  result: '5'
} */
abides('5', [numberCoerce, ofType(Number)])
// => { ok: true, errors: [], self: { error: null }, result: 5 }

more examples

install

yarn add abides
or npm
npm i --save abides

planned changes

  • validator caching
  • async support
  • web forms ready errors
  • typescript implementation

requirements

  • ES2017 (as in, node 8, a modern browser or a babel like library)

other docs

open to contributions

help is needed in:

  • typescript definition and type check tests.

Keywords

validation

FAQs

Package last updated on 14 Apr 2020

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