validity-validate-if-property-not-set

    0.1.0 • Public • Published

    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

    Keywords

    none

    Install

    npm i validity-validate-if-property-not-set

    DownloadsWeekly Downloads

    10

    Version

    0.1.0

    License

    ISC

    Unpacked Size

    1.95 kB

    Total Files

    3

    Last publish

    Collaborators

    • jack828