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

@levshitsvv/formsy-react

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@levshitsvv/formsy-react - npm Package Compare versions

Comparing version 2.0.9 to 2.0.10

16

lib/index.js

@@ -211,3 +211,7 @@ 'use strict';

return Promise.all([_utils2.default.runRules(value, currentValues, component.validations, _validationRules2.default), _utils2.default.runRules(value, currentValues, component.requiredValidations, _validationRules2.default)]).then(function (_ref) {
return _this.runValidationInternal(component.props.name, value, currentValues, component.validations, component.requiredValidations, validationError, validationErrors);
};
_this.runValidationInternal = (0, _utils.memoize)(function (name, value, currentValues, validations, requiredValidations, validationError, validationErrors) {
return Promise.all([_utils2.default.runRules(value, currentValues, validations, _validationRules2.default), _utils2.default.runRules(value, currentValues, requiredValidations, _validationRules2.default)]).then(function (_ref) {
var _ref2 = _slicedToArray(_ref, 2),

@@ -217,4 +221,4 @@ validationResults = _ref2[0],

var isRequired = Object.keys(component.requiredValidations).length ? !!requiredResults.success.length : false;
var isValid = !validationResults.failed.length && !(_this.props.validationErrors && _this.props.validationErrors[component.props.name]);
var isRequired = Object.keys(requiredValidations).length ? !!requiredResults.success.length : false;
var isValid = !validationResults.failed.length && !(_this.props.validationErrors && _this.props.validationErrors[name]);
return {

@@ -232,4 +236,4 @@ isRequired: isRequired,

if (_this.props.validationErrors && _this.props.validationErrors[component.props.name]) {
return typeof _this.props.validationErrors[component.props.name] === 'string' ? [_this.props.validationErrors[component.props.name]] : _this.props.validationErrors[component.props.name];
if (_this.props.validationErrors && _this.props.validationErrors[name]) {
return typeof _this.props.validationErrors[name] === 'string' ? [_this.props.validationErrors[name]] : _this.props.validationErrors[name];
}

@@ -254,3 +258,3 @@

});
};
});

@@ -257,0 +261,0 @@ _this.attachToForm = function (component) {

@@ -6,5 +6,12 @@ 'use strict';

});
exports.memoize = undefined;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _hashSum = require('hash-sum');
var _hashSum2 = _interopRequireDefault(_hashSum);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {

@@ -104,2 +111,27 @@ arraysDiffer: function arraysDiffer(a, b) {

}
};
var memoize = exports.memoize = function memoize(fn) {
var __cache__ = {
values: new Map(),
additionalInfo: {}
};
return function () {
var returnedValue = void 0;
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var hashKey = (0, _hashSum2.default)(args);
if (__cache__.values.has(hashKey)) {
returnedValue = __cache__.values.get(hashKey);
} else {
returnedValue = fn.apply(this, args);
__cache__.values.set(hashKey, returnedValue);
}
return returnedValue;
};
};

@@ -212,3 +212,5 @@ 'use strict';

value: function componentWillReceiveProps(nextProps) {
this.setValidations(nextProps.validations, nextProps.required);
if (!_utils2.default.isSame(this.props.validations, nextProps.validations) || !_utils2.default.isSame(this.props.required, nextProps.required)) {
this.setValidations(nextProps.validations, nextProps.required);
}
}

@@ -215,0 +217,0 @@ }, {

{
"name": "@levshitsvv/formsy-react",
"version": "2.0.9",
"version": "2.0.10",
"description": "A form input builder and validator for React",

@@ -40,2 +40,3 @@ "keywords": [

"form-data-to-object": "^0.2.0",
"hash-sum": "^2.0.0",
"prop-types": "^15.5.10"

@@ -42,0 +43,0 @@ },

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