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

easy-react-form

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easy-react-form - npm Package Compare versions

Comparing version 2.0.7 to 2.0.8

5

CHANGELOG.md
<!-- pass through `required` property even when the field is not empty: maybe add some `passThroughRequiredWhenNotEmpty` configuration option. -->
2.0.8 / 17.02.2023
==================
* Removed the second argument of the `validate()` function — the argument that contained all form values.
2.0.7 / 12.02.2023

@@ -4,0 +9,0 @@ ==================

26

commonjs/field.js

@@ -99,3 +99,4 @@ "use strict";

onBlur = _this$props3.onBlur;
var error = _this.validate(context.state.values[_this.getName()]);
var value = context.state.values[_this.getName()];
var error = _this.validate(value);
// The `error` was `undefined` while the field was focused.

@@ -157,12 +158,15 @@ if (error) {

if (validate) {
// `context.state.values` could be replaced with
// something else, like `context.getValues()`
// because `<List/>` values are prefixed in `context.state.values`.
// But running RegExps and re-creating the object
// on each `validate()` call seems like a not-the-best architecture.
// Instead `values` could be replaced with something like
// `context.getValues()` but that would be a "breaking change" in the API.
// On a modern CPU a single `context.getValues()` run is about 0.005 ms.
// So I guess it's acceptable, since the API already exists.
return validate(value, context.getValues());
// // `context.state.values` could be replaced with
// // something else, like `context.getValues()`
// // because `<List/>` values are prefixed in `context.state.values`.
// // But running RegExps and re-creating the object
// // on each `validate()` call seems like a not-the-best architecture.
// // Instead `values` could be replaced with something like
// // `context.getValues()` but that would be a "breaking change" in the API.
// // On a modern CPU a single `context.getValues()` run is about 0.005 ms.
// // So I guess it's acceptable, since the API already exists.
// const allValues = context.getValues()
// return validate(value, allValues)
return validate(value);
}

@@ -169,0 +173,0 @@ }

@@ -92,3 +92,4 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

onBlur = _this$props3.onBlur;
var error = _this.validate(context.state.values[_this.getName()]);
var value = context.state.values[_this.getName()];
var error = _this.validate(value);
// The `error` was `undefined` while the field was focused.

@@ -150,12 +151,15 @@ if (error) {

if (validate) {
// `context.state.values` could be replaced with
// something else, like `context.getValues()`
// because `<List/>` values are prefixed in `context.state.values`.
// But running RegExps and re-creating the object
// on each `validate()` call seems like a not-the-best architecture.
// Instead `values` could be replaced with something like
// `context.getValues()` but that would be a "breaking change" in the API.
// On a modern CPU a single `context.getValues()` run is about 0.005 ms.
// So I guess it's acceptable, since the API already exists.
return validate(value, context.getValues());
// // `context.state.values` could be replaced with
// // something else, like `context.getValues()`
// // because `<List/>` values are prefixed in `context.state.values`.
// // But running RegExps and re-creating the object
// // on each `validate()` call seems like a not-the-best architecture.
// // Instead `values` could be replaced with something like
// // `context.getValues()` but that would be a "breaking change" in the API.
// // On a modern CPU a single `context.getValues()` run is about 0.005 ms.
// // So I guess it's acceptable, since the API already exists.
// const allValues = context.getValues()
// return validate(value, allValues)
return validate(value);
}

@@ -162,0 +166,0 @@ }

{
"name": "easy-react-form",
"version": "2.0.7",
"version": "2.0.8",
"description": "Simple, fast and easy-to-use React Form.",

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

@@ -193,3 +193,3 @@ # easy-react-form

* `validate(value, allFormValues) : String` — Form field value validation function. Is only called when `value` is not "empty": `null` / `undefined` / `""` / `[]`. Should return an error message if the field value is invalid.
* `validate(value) : String?` — Form field value validation function. Is only called when `value` is not "empty": `null` / `undefined` / `""` / `[]`. Should return an error message if the field value is invalid.

@@ -196,0 +196,0 @@ * `required : String or Boolean` — adds "this field is required" validation for the `<Field/>` with the `error` message equal to `required` property value if it's a `String` defaulting to `"Required"` otherwise. Note that `value={false}` is valid in case of `required` because `false` is a non-empty value (e.g. "Yes"/"No" dropdown), therefore use `validate` function instead of `required` for checkboxes that are required to be checked, otherwise an unchecked checkbox will have `value={false}` and will pass the `required` check.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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