unobtrusive-validation
Advanced tools
Comparing version 0.3.0 to 1.0.0
@@ -9,3 +9,3 @@ (function (global, factory) { | ||
* https://github.com/kraaden/unobtrusive-validation | ||
* Copyright (c) 2016 Denys Krasnoshchok | ||
* Copyright (c) 2021 - Denys Krasnoshchok | ||
* MIT License | ||
@@ -12,0 +12,0 @@ */ |
22
index.ts
/* | ||
* https://github.com/kraaden/unobtrusive-validation | ||
* Copyright (c) 2016 Denys Krasnoshchok | ||
* Copyright (c) 2021 - Denys Krasnoshchok | ||
* MIT License | ||
@@ -16,3 +16,3 @@ */ | ||
*/ | ||
export const form_validation_handlers: ((evt: Event, succeeded: boolean) => void)[] = []; | ||
export const validationHandlers: ((evt: Event, succeeded: boolean) => void)[] = []; | ||
@@ -22,3 +22,3 @@ /** | ||
*/ | ||
export const form_validators: ((element: IFormElement) => boolean)[] = []; | ||
export const validators: ((element: IFormElement) => boolean)[] = []; | ||
@@ -53,3 +53,3 @@ function getElementValue(element: IFormElement): string { | ||
let success = true; | ||
for (const validator of form_validators) { | ||
for (const validator of validators) { | ||
success = success && validator(element); | ||
@@ -224,11 +224,11 @@ } | ||
form_validators.push(requiredValidator); | ||
form_validators.push(lengthValidator); | ||
form_validators.push(regexValidator); | ||
form_validators.push(rangeValidator); | ||
form_validators.push(numberValidator); | ||
form_validators.push(equalityValidator); | ||
validators.push(requiredValidator); | ||
validators.push(lengthValidator); | ||
validators.push(regexValidator); | ||
validators.push(rangeValidator); | ||
validators.push(numberValidator); | ||
validators.push(equalityValidator); | ||
function executeHandlers(evt: Event, succeeded: boolean) { | ||
for (let handler of form_validation_handlers) { | ||
for (let handler of validationHandlers) { | ||
handler(evt, succeeded); | ||
@@ -235,0 +235,0 @@ } |
{ | ||
"name": "unobtrusive-validation", | ||
"version": "0.3.0", | ||
"version": "1.0.0", | ||
"description": "Lightweight unobtrusive ASP.NET validation without dependencies", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -28,5 +28,5 @@ # Unobtrusive validation library without dependencies | ||
import { form_validation_handlers } from 'unobtrusive-validation'; | ||
import { validationHandlers } from 'unobtrusive-validation'; | ||
form_validation_handlers.push(function(evt, succeeded) { | ||
validationHandlers.push(function(evt, succeeded) { | ||
if (!succeeded) { | ||
@@ -39,3 +39,3 @@ hideSpinner(); | ||
const handlers = window["unobtrusive-validation"].form_validation_handlers; | ||
const handlers = window["unobtrusive-validation"].validationHandlers; | ||
@@ -42,0 +42,0 @@ handlers.push(function(evt, succeeded) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
52992