99/*globals require: false, exports: false, define: false, ko: false */
1010
1111( function ( factory ) {
12- // Module systems magic dance.
13-
14- if ( typeof require === "function" && typeof exports === "object" && typeof module === "object" ) {
15- // CommonJS or Node: hard-coded dependency on "knockout"
16- factory ( require ( "knockout" ) , exports ) ;
17- } else if ( typeof define === "function" && define [ "amd" ] ) {
18- // AMD anonymous module with hard-coded dependency on "knockout"
19- define ( [ "knockout" , "exports" ] , factory ) ;
20- } else {
21- // <script> tag: use the global `ko` object, attaching a `mapping` property
22- factory ( ko , ko . validation = { } ) ;
23- }
12+ // Module systems magic dance.
13+
14+ if ( typeof require === "function" && typeof exports === "object" && typeof module === "object" ) {
15+ // CommonJS or Node: hard-coded dependency on "knockout"
16+ factory ( require ( "knockout" ) , exports ) ;
17+ } else if ( typeof define === "function" && define [ "amd" ] ) {
18+ // AMD anonymous module with hard-coded dependency on "knockout"
19+ define ( [ "knockout" , "exports" ] , factory ) ;
20+ } else {
21+ // <script> tag: use the global `ko` object, attaching a `mapping` property
22+ factory ( ko , ko . validation = { } ) ;
23+ }
2424} ( function ( ko , exports ) {
2525
26- if ( typeof ( ko ) === 'undefined' ) { throw 'Knockout is required, please ensure it is loaded before loading this validation plug-in' ; }
26+ if ( typeof ( ko ) === 'undefined' ) {
27+ throw new Error ( 'Knockout is required, please ensure it is loaded before loading this validation plug-in' ) ;
28+ }
2729
28- // create our namespace object
29- ko . validation = exports ;
30+ // create our namespace object
31+ ko . validation = exports ;
3032
31- var kv = ko . validation ,
33+ var kv = ko . validation ,
3234 koUtils = ko . utils ,
3335 unwrap = koUtils . unwrapObservable ,
3436 forEach = koUtils . arrayForEach ,
@@ -781,8 +783,8 @@ function minMaxValidatorFactory(validatorName) {
781783 regex = / ^ ( \d { 4 } ) - W ( \d { 2 } ) $ / ;
782784 valMatches = val . match ( regex ) ;
783785 if ( valMatches === null ) {
784- throw "Invalid value for " + validatorName + " attribute for week input. Should look like " +
785- "'2000-W33' http://www.w3.org/TR/html-markup/input.week.html#input.week.attrs.min" ;
786+ throw new Error ( "Invalid value for " + validatorName + " attribute for week input. Should look like " +
787+ "'2000-W33' http://www.w3.org/TR/html-markup/input.week.html#input.week.attrs.min" ) ;
786788 }
787789 comparisonValueMatches = comparisonValue . match ( regex ) ;
788790 // If no regex matches were found, validation fails
@@ -805,8 +807,8 @@ function minMaxValidatorFactory(validatorName) {
805807 regex = / ^ ( \d { 4 } ) - ( \d { 2 } ) $ / ;
806808 valMatches = val . match ( regex ) ;
807809 if ( valMatches === null ) {
808- throw "Invalid value for " + validatorName + " attribute for month input. Should look like " +
809- "'2000-03' http://www.w3.org/TR/html-markup/input.month.html#input.month.attrs.min" ;
810+ throw new Error ( "Invalid value for " + validatorName + " attribute for month input. Should look like " +
811+ "'2000-03' http://www.w3.org/TR/html-markup/input.month.html#input.month.attrs.min" ) ;
810812 }
811813 comparisonValueMatches = comparisonValue . match ( regex ) ;
812814 // If no regex matches were found, validation fails
0 commit comments