New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

indicative

Package Overview
Dependencies
Maintainers
1
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

indicative - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

2

package.json
{
"name": "indicative",
"version": "2.0.1",
"version": "2.0.2",
"description": "Intentionally beautiful schema and raw validator for nodejs",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -16,2 +16,9 @@ 'use strict'

/**
* modes supported by indicative
* @type {Array}
*/
const modes = ['normal', 'string strict']
let currentMode = 'normal'
/**
* @module Validator

@@ -53,2 +60,3 @@ * @description Validator to run through an object

}
Validator.transformFieldValue(data, field)
return Validations[convertedValidation](data, field, message, validationRules[validation].args, dotProp.get)

@@ -77,2 +85,18 @@ .catch(function (message) {

/**
* @description sets field value to null when current field is empty
* and when currentMode is set to string strict
* @param {Object} data
* @param {String} field
* @return {void}
*/
Validator.transformFieldValue = function (data, field) {
if(currentMode === 'string strict') {
const value = dotProp.get(data, field)
if(typeof(value) === 'string' && value.length === 0){
dotProp.set(data, field, null)
}
}
}
/**
* @description validates an object of rules by parsing

@@ -153,2 +177,16 @@ * rules and custom messages.It is a very high level

/**
* @description setting up validation mode for indicative
* @method setMode
* @param {String} mode
* @public
*/
Validator.setMode = function (mode) {
if(modes.indexOf(mode) <= -1) {
console.log(`indicative: ${mode} is not a valid mode, switching back to normal mode`)
return
}
currentMode = mode
}
/**
* attaching raw validator

@@ -155,0 +193,0 @@ * @type {Object}

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