Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

validate-promise

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

validate-promise

Promised based validaation library

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
112
decreased by-41.97%
Maintainers
1
Weekly downloads
 
Created
Source

validation-promise

Promised based validation library

Installation

npm install validate-promise

Usage

Validates an object against a specified validation contract

import validate from 'validation-promise';

var contract = [
  {
    key: 'age',
    promises: [int],
    msg: (value, row, arg) => value + ' not an int',
    arg: {}
  }
];

var data = {
  age: '11'
};

validate(contract, data)
  .then(() => {
    // The validations have passed...
  })
  .catch(error => {
    // Validations failed - error is an object keyed on data keys, and containing an array of error messages.
  });

Validations

  • After
  • Before
  • Greaterthan
  • Int
  • Lessthan
  • Required
  • Whitelist

Keywords

FAQs

Package last updated on 04 Jan 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc