@mutt/forms
Advanced tools
Comparing version 2.0.2 to 2.2.1
{ | ||
"name": "@mutt/forms", | ||
"version": "2.0.2", | ||
"version": "2.2.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -161,5 +161,26 @@ /** | ||
// Run each of the subfields' validators | ||
Object.values(this.object).forEach(field => field.validate()) | ||
// Run this field's validators | ||
if (this.validators.length > 0) { | ||
for (const validator of this.validators) { | ||
if (!validator.validate(this.value)) { | ||
for (const [fieldName, error] of Object.entries(validator.error)) { | ||
const field = this.object[fieldName] | ||
// Add a field error whilst maintaining any existing ones | ||
field.errors = error | ||
// Re-render the widget to show the error | ||
field.widget.refreshErrorState(field.errors) | ||
} | ||
} | ||
} | ||
} | ||
// Make all of the subfields' errors available to this field | ||
for (let key of Object.keys(this.object)) { | ||
let field = this.object[key] | ||
if (!field.validate()) { | ||
if (field.errors.length) { | ||
this._errors[key] = field.errors | ||
@@ -166,0 +187,0 @@ valid = false |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
324164
4694
0