diff --git a/README.md b/README.md index c32ad84..b8242cf 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![Release version](https://img.shields.io/github/release/jwaliszko/ExpressiveAnnotations.svg)](https://github.com/jwaliszko/ExpressiveAnnotations/releases/latest) [![License](http://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT) -A small .NET and JavaScript library which provides annotation-based conditional validation mechanisms. Given attributes allow to forget about imperative way of step-by-step verification of validation conditions in many cases. Since fields validation requirements are applied as metadata, domain-related code is more condensed. +A small .NET and JavaScript library which provides full-stack, annotation-based, conditional validation mechanisms. Given attributes, powered by expressions engine, allow to forget about imperative way of step-by-step verification of validation conditions in many cases. Since fields validation requirements are applied as metadata, domain-related code is more condensed. ### Table of contents - [What is the context behind this work?](#what-is-the-context-behind-this-implementation) @@ -501,7 +501,7 @@ Because client-side handles expressions in its unchanged form (as provided to at Client-side validation is fully supported. Enable it for your web project within the next few steps: -1. Reference both assemblies to your project: core [**ExpressiveAnnotations.dll**](src/ExpressiveAnnotations) and subsidiary [**ExpressiveAnnotations.MvcUnobtrusive.dll**](src/ExpressiveAnnotations.MvcUnobtrusive). +1. Reference both assemblies to your project: core [**ExpressiveAnnotations.dll**](src/ExpressiveAnnotations) (defines validation attributes driven by expressions) and subsidiary [**ExpressiveAnnotations.MvcUnobtrusive.dll**](src/ExpressiveAnnotations.MvcUnobtrusive) (defines model validators for ASP.NET MVC). 2. In Global.asax register required validators (`IClientValidatable` interface is not directly implemented by the attributes, to avoid coupling of ExpressionAnnotations assembly with System.Web.Mvc dependency): ```C# @@ -531,7 +531,7 @@ Client-side validation is fully supported. Enable it for your web project within ``` Despite the fact this provider automatically registers adapters for expressive validation attributes, it additionally respects their processing priorities when validation is performed (i.e. the [`Priority`](#signatures) property actually means something in practice). -3. Include [**expressive.annotations.validate.js**](src/expressive.annotations.validate.js?raw=true) script in your page (it should be included in bundle below jQuery validation files): +3. Include [**expressive.annotations.validate.js**](src/expressive.annotations.validate.js?raw=true) script (makes client-side validation to work out of the box) in your page. It should be included in bundle below jQuery validation files: ```JavaScript diff --git a/bower.json b/bower.json deleted file mode 100644 index d20ae35..0000000 --- a/bower.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "expressive-annotations", - "version": "2.7.4-pre", - "license": "MIT", - "homepage": "https://github.com/jwaliszko/ExpressiveAnnotations", - "description": "Client-side component of ExpressiveAnnotations - annotation-based conditional validation library.", - "authors": [ - "Jarosław Waliszko " - ], - "main": "dist/expressive.annotations.validate.js", - "repository": { - "type": "git", - "url": "git://github.com/jwaliszko/ExpressiveAnnotations.git" - }, - "dependencies": { - "jquery": ">=1.8.2", - "jquery-validation-unobtrusive": ">=3.1.1", - "jquery-validation": ">=1.10.0" - }, - "keywords": [ - "conditional", - "validation", - "mvc", - "dataannotations" - ], - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "*.nupkg", - "*.zip" - ] -} \ No newline at end of file diff --git a/build/ExpressiveAnnotations.dll.nuspec b/build/ExpressiveAnnotations.dll.nuspec index ecf37a8..11036e2 100644 --- a/build/ExpressiveAnnotations.dll.nuspec +++ b/build/ExpressiveAnnotations.dll.nuspec @@ -3,17 +3,17 @@ ExpressiveAnnotations.dll $version$ - ExpressiveAnnotations core assembly + Server-side component of ExpressiveAnnotations Jarosław Waliszko Jarosław Waliszko https://raw.githubusercontent.com/jwaliszko/ExpressiveAnnotations/master/logo.png https://github.com/jwaliszko/ExpressiveAnnotations/blob/master/LICENSE https://github.com/jwaliszko/ExpressiveAnnotations false - ExpressiveAnnotations is a small .NET and JavaScript library which provides annotation-based conditional validation mechanisms. Given attributes allow to forget about imperative way of step-by-step verification of validation conditions in many cases. Since fields validation requirements are applied as metadata, domain-related code is more condensed. + ExpressiveAnnotations is a small .NET and JavaScript library which provides full-stack annotation-based conditional validation mechanisms. Given attributes, powered by expressions engine, allow to forget about imperative way of step-by-step verification of validation conditions in many cases. Since fields validation requirements are applied as metadata, domain-related code is more condensed. -This package contains only single component, mainly ExpressiveAnnotations.dll core annotations assembly. - Server-only component of ExpressiveAnnotations - a small .NET and JavaScript library which provides annotation-based conditional validation mechanisms. +This package contains single component, i.e. ExpressiveAnnotations.dll - assembly with validation attributes powered by expressions engine. + Server-side component of ExpressiveAnnotations - annotation-based conditional validation library. https://github.com/jwaliszko/ExpressiveAnnotations/releases en-US DataAnnotations Validation diff --git a/build/ExpressiveAnnotations.nuspec b/build/ExpressiveAnnotations.nuspec index c272ee4..c84145e 100644 --- a/build/ExpressiveAnnotations.nuspec +++ b/build/ExpressiveAnnotations.nuspec @@ -3,16 +3,19 @@ ExpressiveAnnotations $version$ - ExpressiveAnnotations for ASP.NET MVC + Full-stack declarative validation for ASP.NET MVC Jarosław Waliszko Jarosław Waliszko https://raw.githubusercontent.com/jwaliszko/ExpressiveAnnotations/master/logo.png https://github.com/jwaliszko/ExpressiveAnnotations/blob/master/LICENSE https://github.com/jwaliszko/ExpressiveAnnotations false - ExpressiveAnnotations is a small .NET and JavaScript library which provides annotation-based conditional validation mechanisms. Given attributes allow to forget about imperative way of step-by-step verification of validation conditions in many cases. Since fields validation requirements are applied as metadata, domain-related code is more condensed. + ExpressiveAnnotations is a small .NET and JavaScript library which provides full-stack, annotation-based, conditional validation mechanisms. Given attributes, powered by expressions engine, allow to forget about imperative way of step-by-step verification of validation conditions in many cases. Since fields validation requirements are applied as metadata, domain-related code is more condensed. -This package contains 3 components: ExpressiveAnnotations.dll - core annotations assembly, ExpressiveAnnotations.MvcUnobtrusive.dll - MVC validators assembly and expressive.annotations.validate.js - unobtrusive validation script. +This package contains 3 components: + - ExpressiveAnnotations.dll - assembly with validation attributes powered by expressions engine, + - ExpressiveAnnotations.MvcUnobtrusive.dll - assembly with model validators for ASP.NET MVC, + - expressive.annotations.validate.js - unobtrusive validation script. A small .NET and JavaScript library which provides annotation-based conditional validation mechanisms. https://github.com/jwaliszko/ExpressiveAnnotations/releases en-US diff --git a/build/release.sh b/build/release.sh index d492fe8..1a61af0 100644 --- a/build/release.sh +++ b/build/release.sh @@ -56,31 +56,32 @@ cp expressive.annotations.validate.min.js ../src/expressive.annotations.validate echo -e "\n------ package building..." coreVersion=`strings ../src/ExpressiveAnnotations/bin/Release/ExpressiveAnnotations.dll | egrep '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | cut -f1,2,3 -d"."` ./nuget.exe pack ExpressiveAnnotations.nuspec -version $productVersion -symbols -./nuget.exe pack ExpressiveAnnotations.dll.nuspec -version $coreVersion -symbols +./nuget.exe pack ExpressiveAnnotations.dll.nuspec -version $coreVersion scriptVersion=`strings ../src/expressive.annotations.validate.js | egrep -o -m1 '[0-9]+\.[0-9]+\.[0-9]+'` -sed -E 's/[0-9]+\.[0-9]+\.[0-9]+-pre/'$scriptVersion'/' ../bower.json > bower.json -sed -E 's/[0-9]+\.[0-9]+\.[0-9]+-pre/'$scriptVersion'/' ../package.json > package.json +sed -E 's/\$version\$/'$scriptVersion'/' ../package.json > package.json unobVersion=`strings ../src/ExpressiveAnnotations.MvcUnobtrusive/bin/Release/ExpressiveAnnotations.MvcUnobtrusive.dll | egrep '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | cut -f1,2,3 -d"."` -echo "This product version contains following components: -ExpressiveAnnotations.dll v"$coreVersion", ExpressiveAnnotations.MvcUnobtrusive.dll v"$unobVersion", expressive.annotations.validate.js v"$scriptVersion"" > readme.txt -unix2dos readme.txt +echo "EA v"$productVersion" (full-stack product version) consists of the following components: +ExpressiveAnnotations.dll v"$coreVersion", ExpressiveAnnotations.MvcUnobtrusive.dll v"$unobVersion", expressive.annotations.validate.js v"$scriptVersion"" > NOTES +unix2dos NOTES echo -e "\n------ archive creation..." -mkdir -p $productVersion/dist -mv net* $productVersion/dist -mv expressive.annotations.validate* $productVersion/dist -mv *.txt $productVersion/dist -cp ../doc/api/api.chm $productVersion/dist +mkdir -p $productVersion/ExpressiveAnnotations/dist +mv net* $productVersion/ExpressiveAnnotations/dist +mv expressive.annotations.validate* $productVersion/ExpressiveAnnotations/dist +mv NOTES $productVersion/ExpressiveAnnotations +cp ../doc/api/api.chm $productVersion/ExpressiveAnnotations +cp ../README.md $productVersion/ExpressiveAnnotations +cp ../LICENSE $productVersion/ExpressiveAnnotations +cp ../logo.png $productVersion/ExpressiveAnnotations mv *.nupkg $productVersion mv *.json $productVersion cd $productVersion -mv dist ExpressiveAnnotations zip -r ExpressiveAnnotations.zip ExpressiveAnnotations -mv ExpressiveAnnotations dist cd .. # nuget setapikey ... -# nuget push ExpressiveAnnotations.x.x.x.nupkg +# nuget push ExpressiveAnnotations.x.x.x.nupkg -source https://www.nuget.org +# nuget push ExpressiveAnnotations.dll.x.x.x.nupkg -source https://www.nuget.org diff --git a/doc/api/api.chm b/doc/api/api.chm index 1ee0437..095ecbc 100644 Binary files a/doc/api/api.chm and b/doc/api/api.chm differ diff --git a/package.json b/package.json index 240a9a2..1580e73 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,15 @@ { - "name": "expressive-annotations", - "version": "2.7.4-pre", + "name": "expressive-annotations-validate", + "version": "$version$", "license": "MIT", "homepage": "https://github.com/jwaliszko/ExpressiveAnnotations", - "description": "Client-side component of ExpressiveAnnotations - annotation-based conditional validation library.", + "description": "Client-side component of ExpressiveAnnotations", "author": "Jarosław Waliszko ", - "main": "src/expressive.annotations.validate.js", + "main": "dist/expressive.annotations.validate.js", + "files": [ + "dist/expressive.annotations.validate.js", + "dist/expressive.annotations.validate.min.js" + ], "repository": { "type": "git", "url": "git://github.com/jwaliszko/ExpressiveAnnotations.git" @@ -16,9 +20,9 @@ "jquery-validation": ">=1.10.0" }, "keywords": [ - "conditional", "validation", "mvc", + "aspnetmvc", "dataannotations" ] } \ No newline at end of file diff --git a/src/expressive.annotations.validate.min.js b/src/expressive.annotations.validate.min.js index 28fe709..3623269 100644 --- a/src/expressive.annotations.validate.min.js +++ b/src/expressive.annotations.validate.min.js @@ -4,4 +4,4 @@ * * Copyright (c) 2014 Jarosław Waliszko * Licensed MIT: http://opensource.org/licenses/MIT */ -!function(e,t){"use strict";var n=t.ea,r=t.console,i={settings:{debug:!1,optimize:!0,enumsAsNumbers:!0,registerAllMethods:!1,dependencyTriggers:"change keyup",apply:function(t){!function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}(i.settings,t),function(){if(!a.isBool(i.settings.debug))throw"EA settings error: debug value must be a boolean (true or false)";if(!a.isBool(i.settings.optimize))throw"EA settings error: optimize value must be a boolean (true or false)";if(!a.isBool(i.settings.enumsAsNumbers))throw"EA settings error: enumsAsNumbers value must be a boolean (true or false)";if(!a.isBool(i.settings.registerAllMethods))throw"EA settings error: registerAllMethods value must be a boolean (true or false)";if(!a.isString(i.settings.dependencyTriggers)&&null!==i.settings.dependencyTriggers&&void 0!==i.settings.dependencyTriggers)throw"EA settings error: dependencyTriggers value must be a string (multiple event types can be bound at once by including each one separated by a space), null or undefined"}(),e("form").each(function(){e(this).find("input, select, textarea").off(".expressive.annotations"),d.bindFields(this,!0)}),s.info(a.string.format("EA settings applied:\n{0}",t))}},addMethod:function(e,t){o.addMethod(e,t)},addValueParser:function(e,t){a.addValueParser(e,t)},noConflict:function(){return t.ea===this&&(t.ea=n),this}},s={info:function(e){i.settings.debug&&r&&"function"==typeof r.log&&r.log("[info] "+s.prep(e,new Date))},warn:function(e){r&&"function"==typeof r.warn&&r.warn("[warn] "+s.prep(e,new Date))},fail:function(e){r&&"function"==typeof r.error&&r.error("[fail] "+s.prep(e,new Date))},prep:function(e,t){var n=(e=a.string.tryParse(e)).split("\n"),r=(void 0!==t&&null!==t?"("+a.datetime.stamp(t)+"): ":"")+n.shift();return n.length>0?r+"\n"+a.string.indent(n.join("\n"),19):r}},o={methods:{},addMethod:function(e,t){var n=this.methods[e];this.methods[e]=function(){return t.length===arguments.length?t.apply(this,arguments):"function"==typeof n?n.apply(this,arguments):t.apply(this,arguments)}},registerMethods:function(e,t,n){var r,o,u;if(this.initialize(),i.settings.registerAllMethods){for(o in this.methods)if(this.methods.hasOwnProperty(o)){if(e.hasOwnProperty(o)){s.warn(a.string.format("Field {0} - skipping {1}(...) method registration, naming conflict with the field identifier.",n,o));continue}u=this.methods[o],e[o]=u}}else for(r=0;rt?1:-1}),this.addMethod("CompareOrdinalIgnoreCase",function(e,n){return e=null!==e&&void 0!==e?e.toLowerCase():null,n=null!==n&&void 0!==n?n.toLowerCase():null,t.methods.CompareOrdinal(e,n)}),this.addMethod("StartsWith",function(e,t){return null!==e&&void 0!==e&&null!==t&&void 0!==t&&e.slice(0,t.length)===t}),this.addMethod("StartsWithIgnoreCase",function(e,n){return e=null!==e&&void 0!==e?e.toLowerCase():null,n=null!==n&&void 0!==n?n.toLowerCase():null,t.methods.StartsWith(e,n)}),this.addMethod("EndsWith",function(e,t){return null!==e&&void 0!==e&&null!==t&&void 0!==t&&e.slice(-t.length)===t}),this.addMethod("EndsWithIgnoreCase",function(e,n){return e=null!==e&&void 0!==e?e.toLowerCase():null,n=null!==n&&void 0!==n?n.toLowerCase():null,t.methods.EndsWith(e,n)}),this.addMethod("Contains",function(e,t){return null!==e&&void 0!==e&&null!==t&&void 0!==t&&e.indexOf(t)>-1}),this.addMethod("ContainsIgnoreCase",function(e,n){return e=null!==e&&void 0!==e?e.toLowerCase():null,n=null!==n&&void 0!==n?n.toLowerCase():null,t.methods.Contains(e,n)}),this.addMethod("IsNullOrWhiteSpace",function(e){return null===e||!/\S/.test(e)}),this.addMethod("IsDigitChain",function(e){return/^[0-9]+$/.test(e)}),this.addMethod("IsNumber",function(e){return/^[+-]?(?:(?:[0-9]+)|(?:[0-9]+[eE][+-]?[0-9]+)|(?:[0-9]*\.[0-9]+(?:[eE][+-]?[0-9]+)?))$/.test(e)}),this.addMethod("IsEmail",function(e){return/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(e)}),this.addMethod("IsPhone",function(e){return/^(\+\s?)?((?!\+.*)\(\+?\d+([\s\-\.]?\d+)?\)|\d+)([\s\-\.]?(\(\d+([\s\-\.]?\d+)?\)|\d+))*(\s?(x|ext\.?)\s?\d+)?$/.test(e)}),this.addMethod("IsUrl",function(e){return/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/i.test(e)}),this.addMethod("IsRegexMatch",function(e,t){return null!==e&&void 0!==e&&null!==t&&void 0!==t&&new RegExp(t).test(e)}),this.addMethod("Guid",function(e){var t=a.guid.tryParse(e);if(t.error)throw t.msg;return t}),this.addMethod("Min",function(e){if(0===arguments.length)throw"no arguments";if(1===arguments.length&&a.isArray(e)){if(0===e.length)throw"empty sequence";return Math.min.apply(null,e)}return Math.min.apply(null,arguments)}),this.addMethod("Max",function(e){if(0===arguments.length)throw"no arguments";if(1===arguments.length&&a.isArray(e)){if(0===e.length)throw"empty sequence";return Math.max.apply(null,e)}return Math.max.apply(null,arguments)}),this.addMethod("Sum",function(e){if(0===arguments.length)throw"no arguments";var t,n,r=0;if(1===arguments.length&&a.isArray(e)){if(0===e.length)throw"empty sequence";for(t=0,n=e.length;t2&&s.warn(a.string.format("DOM field {0} is ambiguous (unless custom value parser is provided).",e.attr("name"))),e.is(":checked");case"radio":return e.filter(":checked").val();default:return e.length>1&&s.warn(a.string.format("DOM field {0} is ambiguous (unless custom value parser is provided).",e.attr("name"))),e.val()}}(u))||void 0===l||""===l)return null;if(null!==(f=a.tryParse(l,i,d,o))&&void 0!==f&&f.error)throw a.string.format("DOM field {0} value conversion to {1} failed. {2}",d,i,f.msg);return f},deserializeObject:function(e,t,n,r,s,o){function a(e,t,n){var r,i,s,o,a,u,d;for(d=/^([a-z_0-9]+)\[([0-9]+)\]$/i,r=e.split("."),i=n,s=0;s0?r+"\n"+a.string.indent(n.join("\n"),19):r}},o={methods:{},addMethod:function(e,t){var n=this.methods[e];this.methods[e]=function(){return t.length===arguments.length?t.apply(this,arguments):"function"==typeof n?n.apply(this,arguments):t.apply(this,arguments)}},registerMethods:function(e,t,n){var r,o,u;if(this.initialize(),i.settings.registerAllMethods){for(o in this.methods)if(this.methods.hasOwnProperty(o)){if(e.hasOwnProperty(o)){s.warn(a.string.format("Field {0} - skipping {1}(...) method registration, naming conflict with the field identifier.",n,o));continue}u=this.methods[o],e[o]=u}}else for(r=0;rt?1:-1}),this.addMethod("CompareOrdinalIgnoreCase",function(e,n){return e=null!==e&&void 0!==e?e.toLowerCase():null,n=null!==n&&void 0!==n?n.toLowerCase():null,t.methods.CompareOrdinal(e,n)}),this.addMethod("StartsWith",function(e,t){return null!==e&&void 0!==e&&null!==t&&void 0!==t&&e.slice(0,t.length)===t}),this.addMethod("StartsWithIgnoreCase",function(e,n){return e=null!==e&&void 0!==e?e.toLowerCase():null,n=null!==n&&void 0!==n?n.toLowerCase():null,t.methods.StartsWith(e,n)}),this.addMethod("EndsWith",function(e,t){return null!==e&&void 0!==e&&null!==t&&void 0!==t&&e.slice(-t.length)===t}),this.addMethod("EndsWithIgnoreCase",function(e,n){return e=null!==e&&void 0!==e?e.toLowerCase():null,n=null!==n&&void 0!==n?n.toLowerCase():null,t.methods.EndsWith(e,n)}),this.addMethod("Contains",function(e,t){return null!==e&&void 0!==e&&null!==t&&void 0!==t&&e.indexOf(t)>-1}),this.addMethod("ContainsIgnoreCase",function(e,n){return e=null!==e&&void 0!==e?e.toLowerCase():null,n=null!==n&&void 0!==n?n.toLowerCase():null,t.methods.Contains(e,n)}),this.addMethod("IsNullOrWhiteSpace",function(e){return null===e||!/\S/.test(e)}),this.addMethod("IsDigitChain",function(e){return/^[0-9]+$/.test(e)}),this.addMethod("IsNumber",function(e){return/^[+-]?(?:(?:[0-9]+)|(?:[0-9]+[eE][+-]?[0-9]+)|(?:[0-9]*\.[0-9]+(?:[eE][+-]?[0-9]+)?))$/.test(e)}),this.addMethod("IsEmail",function(e){return/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(e)}),this.addMethod("IsPhone",function(e){return/^(\+\s?)?((?!\+.*)\(\+?\d+([\s\-\.]?\d+)?\)|\d+)([\s\-\.]?(\(\d+([\s\-\.]?\d+)?\)|\d+))*(\s?(x|ext\.?)\s?\d+)?$/.test(e)}),this.addMethod("IsUrl",function(e){return/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/i.test(e)}),this.addMethod("IsRegexMatch",function(e,t){return null!==e&&void 0!==e&&null!==t&&void 0!==t&&new RegExp(t).test(e)}),this.addMethod("Guid",function(e){var t=a.guid.tryParse(e);if(t.error)throw t.msg;return t}),this.addMethod("Min",function(e){if(0===arguments.length)throw"no arguments";if(1===arguments.length&&a.isArray(e)){if(0===e.length)throw"empty sequence";return Math.min.apply(null,e)}return Math.min.apply(null,arguments)}),this.addMethod("Max",function(e){if(0===arguments.length)throw"no arguments";if(1===arguments.length&&a.isArray(e)){if(0===e.length)throw"empty sequence";return Math.max.apply(null,e)}return Math.max.apply(null,arguments)}),this.addMethod("Sum",function(e){if(0===arguments.length)throw"no arguments";var t,n,r=0;if(1===arguments.length&&a.isArray(e)){if(0===e.length)throw"empty sequence";for(t=0,n=e.length;t2&&s.warn(a.string.format("DOM field {0} is ambiguous (unless custom value parser is provided).",e.attr("name"))),e.is(":checked");case"radio":return e.filter(":checked").val();default:return e.length>1&&s.warn(a.string.format("DOM field {0} is ambiguous (unless custom value parser is provided).",e.attr("name"))),e.val()}}(u))||void 0===l||""===l)return null;if(null!==(f=a.tryParse(l,i,d,o))&&void 0!==f&&f.error)throw a.string.format("DOM field {0} value conversion to {1} failed. {2}",d,i,f.msg);return f},deserializeObject:function(e,t,n,r,s,o){function a(e,t,n){var r,i,s,o,a,u,d;for(d=/^([a-z_0-9]+)\[([0-9]+)\]$/i,r=e.split("."),i=n,s=0;s