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

validity-validate-if-property-not-set

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

validity-validate-if-property-not-set

Validate the current property if another property is not set

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

validity-validate-if-property-not-set

Validate the current property if another property is not set.

Useful if you would like either one or another field to be set.

Installation

yarn add validity-validate-if-property-not-set

Usage

Below is a simple example for usage with schemata and save:

const required = require('validity-required')
const schemata = require('schemata')
const save = require('save')
const collection = save('comment')
const validateIfPropertyNotSet = require('validity-validate-if-property-not-set')

const schema = schemata({
  title: {
    type: String,
    validators: { all: [ validateIfPropertyNotSet('comment', required) ] }
  },
  comment: {
    type: String,
    validators: { all: [ validateIfPropertyNotSet('title', required) ] }
  }
})

Credits

Jack Burgess

FAQs

Package last updated on 08 Aug 2019

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