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

@clocklimited/validity-required

Package Overview
Dependencies
Maintainers
7
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@clocklimited/validity-required

Basic validity style validator to ensure a required property is present in an object.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
85
increased by44.07%
Maintainers
7
Weekly downloads
 
Created
Source

validity-required

Basic validity style validator to ensure a required property is present in an object.

As part of the modularisation of validity, this replaces the built-in validity.required.

build status dependency status

Installation

npm install --save validity-required

Usage


const schemata = require('schemata')
  , required = require('validity-required')
  , schema = schemata(
    { emailAddress:
      { validators: [ required ] }
    })
  , schemaWithCustomMessage = schemata(
    { emailAddress:
      { validators: [ required.setFailureMessage('Where is #{name}?') ] }
    })


schema.validate({}, function (error, errors) {
  console.log(error, errors)
  // null, 'Email Address is required'
})

schemaWithCustomMessage.validate({}, function (error, errors) {
  console.log(error, errors)
  // null, 'Where is Email Address?'
})

Credits

Paul Serby

License

ISC

FAQs

Package last updated on 01 Apr 2022

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