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

validator.js-validate

Package Overview
Dependencies
Maintainers
7
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

validator.js-validate - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

3

CHANGELOG.md
# Changelog
## [v1.0.1](https://github.com/uphold/validator.js-validate/releases/tag/v1.0.1) (2017-05-23)
- Fix masking collection elements [\#3](https://github.com/uphold/validator.js-validate/pull/3) ([ricardogama](https://github.com/ricardogama))
## [v1.0.0](https://github.com/uphold/validator.js-validate/releases/tag/v1.0.0) (2017-03-28)

@@ -4,0 +7,0 @@ - Prepare public release [\#2](https://github.com/uphold/validator.js-validate/pull/2) ([ricardogama](https://github.com/ricardogama))

19

dist/index.js

@@ -30,2 +30,11 @@ 'use strict';

return (0, _lodash4.default)(constraints, (result, values, key) => {
if (Array.isArray(data)) {
const nodes = constraints.constraint.nodes;
return data.map(element => {
return nodes ? maskDataFromConstraints(element, nodes) : element;
});
}
// Skip non existent key.

@@ -36,7 +45,8 @@ if (!data.hasOwnProperty(key)) {

const hasDeeperConstraints = (0, _lodash2.default)(values);
// eslint-disable-next-line no-underscore-dangle
const hasDeeperConstraints = (0, _lodash2.default)(values) || values.__class__ === 'Collection';
const value = data[key];
// Skip value that is not an object and has deeper constraints.
if (hasDeeperConstraints && !(0, _lodash2.default)(value)) {
// Skip value that is not an object or array and has deeper constraints.
if (hasDeeperConstraints && !(0, _lodash2.default)(value) && !Array.isArray(value)) {
return result;

@@ -67,3 +77,4 @@ }

const errors = validator.validate(data, new _validator.Constraint(constraints, { deepRequired: true }), groups);
const constraint = constraints instanceof _validator.Assert ? constraints : new _validator.Constraint(constraints, { deepRequired: true });
const errors = validator.validate(data, constraint, groups);

@@ -70,0 +81,0 @@ if (errors === true) {

{
"name": "validator.js-validate",
"version": "1.0.0",
"version": "1.0.1",
"description": "Opinionated object validation function based on validator.js",

@@ -5,0 +5,0 @@ "homepage": "http://uphold.github.io/validator.js-validate",

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