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

@clocklimited/validity-validate-if-property-equals

Package Overview
Dependencies
Maintainers
7
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@clocklimited/validity-validate-if-property-equals

validate the current property if another property is equal to a particular value

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
7
Created
Source

validity-validate-if-property-equals

Validate the current property if another property is equal to a particular value.

E.g you have a URL property of a schema, which is not a required field. You only want to apply validation to that field if another field has a value equal to a certain value

Installation

npm install validity-validate-if-property-equals --save

Usage

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

var validity = require("@clocklimited/validity"),
  schemata = require("schemata"),
  save = require("save"),
  collection = save("author"),
  validateIfPropertyEquals = require("@clocklimited/validity-validate-if-property-equals");

var schema = schemata({
  type: { type: String },
  url: {
    type: String,
    validators: {
      all: [validateIfPropertyEquals("type", "link", validity.url)],
    },
  },
});

Credits

Adam Duncan

FAQs

Package last updated on 04 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