Jel. ValidatorA collection of validation routines (also used by Jel.FormValidator) Summary | | | | | checks if a string value is not an empty string | | checks if the length of a string value is greater than or equal to a specific value | | checks if the length of a string value is greater than a specific value | | checks if the length of a string value is less than or equal to a specific value | | checks if the length of a string value is less than a specific value | | checks if the length of a string is equal to a specific value | | checks if the length of a string is not equal to a specific value | | checks if the length of a string is between a lower and upper bound (inclusive by default, but can be overridden) | | | | checks if a string value represents a positive or negative integer | | checks if a string value represents a positive integer | | checks if a string value represents a negative integer | | checks if a string value represents a positive or negative float | | checks if a string value represents a positive float | | checks if a string value represents a negative float | | checks if a string value represents a positive or negative float or integer | | checks if a string value represents a positive float or integer | | checks if a string value represents a negative float or integer | | checks if a string value represents a date in a specified format. | | | | checks if a string value represents a valid email address | | | | checks if a string value falls within a given range, assuming a specific type (and format if the type is a date) | | checks if a string value falls within a given range, assuming a specific type (and format if the type is a date), and is case insensitive if type is string | | checks if a string value is equal to another, assuming a specific type (and format if the type is a date) | | checks if a string value is equal to another, assuming a specific type (and format if the type is a date), and is case insensitive if type is string | | checks if a string value is not equal to another, assuming a specific type (and format if the type is a date) | | checks if a string value is not equal to another, assuming a specific type (and format if the type is a date), and is case insensitive if type is string | | checks if a string value is greater than another, assuming a specific type (and format if the type is a date) | | checks if a string value is greater than another, assuming a specific type (and format if the type is a date), and is case insensitive if type is string | | checks if a string value is less than another, assuming a specific type (and format if the type is a date). | | checks if a string value is less than another, assuming a specific type (and format if the type is a date), and is case insensitive if type is string | | checks if a string value is greater than or equal to another, assuming a specific type (and format if the type is a date) | | checks if a string value is greater than or equal to another, assuming a specific type (and format if the type is a date), and is case insensitive if type is string | | checks if a string value is less than or equal to another, assuming a specific type (and format if the type is a date) | | checks if a string value is less than or equal to another, assuming a specific type (and format if the type is a date), and is case insensitive if type is string | | checks if a string value is equal to another, comparing both as integers | | checks if a string value is not equal to another, comparing both as integers | | checks if a string value is less than another, comparing both as integers | | checks if a string value is greater than another, comparing both as integers | | checks if a string value is less than or equal to another, comparing both as integers | | checks if a string value is greater than or equal to another, comparing both as integers | | checks if a string value falls within a given range, comparing as integers | | checks if a string value is equal to another, comparing both as floats | | checks if a string value is not equal to another, comparing both as floats | | checks if a string value is less than another, comparing both as floats | | checks if a string value is greater than another, comparing both as floats | | checks if a string value is less than or equal to another, comparing both as floats | | checks if a string value is greater than or equal to another, comparing both as floats | | checks if a string value falls within a given range, comparing as floats | | checks if a string value is equal to another, comparing both as numeric (float or integer) | | checks if a string value is not equal to another, comparing both as numeric (float or integer) | | checks if a string value is less than another, comparing both as numeric (float or integer) | | checks if a string value is greater than another, comparing both as numeric (float or integer) | | checks if a string value is less than or equal to another, comparing both as numeric (float or integer) | | checks if a string value is greater than or equal to another, comparing both as numeric (float or integer) | | checks if a string value falls within a given range, comparing as numeric (float or integer) | | checks if a string value is equal to another, comparing both as dates | | checks if a string value is not equal to another, comparing both as dates | | checks if a string value is less than another, comparing both as dates | | checks if a string value is greater than another, comparing both as dates | | checks if a string value is less than or equal to another, comparing both as dates | | checks if a string value is greater than or equal to another, comparing both as dates | | checks if a string value falls within a given range, comparing as dates | | checks if a string value when converted to a date is in the future. | | checks if a string value when converted to a date is in the past. |
required| required: function( | value | ) |
|
checks if a string value is not an empty string Arguments| value | string, the string to check |
Returns| true | if condition is met | | false | otherwise |
ExampleJel.Validator.required(""); // false Jel.Validator.required("something"); // true
lengthGe| lengthGe: function( | value, | | info | ) |
|
checks if the length of a string value is greater than or equal to a specific value Arguments| value | string, the string to check | | info | object, required, an object hash that must contain an integer compare property to check against |
Returns| true | if condition is met | | false | otherwise |
ExampleJel.Validator.lengthGe("word", { compare: 4 } ); // true Jel.Validator.lengthGe("word", { compare: 3 } ); // true Jel.Validator.lengthGe("word", { compare: 6 } ); // false
See AlsolengthGt
lengthGt| lengthGt: function( | value, | | info | ) |
|
checks if the length of a string value is greater than a specific value Arguments| value | string, the string to check | | info | object, required, an object hash that must contain an integer compare property to check against |
Returns| true | if condition is met | | false | otherwise |
ExampleJel.Validator.lengthGt("word", { compare: 4 } ); // false Jel.Validator.lengthGt("word", { compare: 3 } ); // true
lengthLe| lengthLe: function( | value, | | info | ) |
|
checks if the length of a string value is less than or equal to a specific value Arguments| value | string, the string to check | | info | object, required, an object hash that must contain an integer compare property to check against |
Returns| true | if condition is met | | false | otherwise |
ExampleJel.Validator.lengthLe("word", { compare: 4 } ); // true Jel.Validator.lengthLe("word", { compare: 5 } ); // false
lengthLt| lengthLt: function( | value, | | info | ) |
|
checks if the length of a string value is less than a specific value Arguments| value | string, the string to check | | info | object, required, an object hash that must contain an integer compare property to check against |
Returns| true | if condition is met | | false | otherwise |
ExampleJel.Validator.lengthLt("word", { compare: 5 } ); // true Jel.Validator.lengthLt("word", { compare: 4 } ); // false
lengthEq| lengthEq: function( | value, | | info | ) |
|
checks if the length of a string is equal to a specific value Arguments| value | string, the string to check | | info | object, required, an object hash that must contain an integer compare property to check against |
Returns| true | if condition is met | | false | otherwise |
ExampleJel.Validator.lengthEq("word", { compare: 4 } ); // true Jel.Validator.lengthEq("word", { compare: 3 } ); // false
lengthNeq| lengthNeq: function( | value, | | info | ) |
|
checks if the length of a string is not equal to a specific value Arguments| value | string, the string to check | | info | object, required, an object hash that must contain an integer compare property to check against |
Returns| true | if condition is met | | false | otherwise |
ExampleJel.Validator.lengthNeq("word", { compare: 4 } ); // false Jel.Validator.lengthNeq("word", { compare: 3 } ); // true
lengthRange| lengthRange: function( | value, | | info | ) |
|
checks if the length of a string is between a lower and upper bound (inclusive by default, but can be overridden) Arguments| value | string, the string to check | | info | object, required, am object hash (see below): |
Info Hash Properties| lower | integer, the lower bound of the length range | | upper | integer, the upper bound of the length range | | inclusive | boolean, whether the range is inclusive of the lower and upper bounds |
Returns| true | if condition is met | | false | otherwise |
ExampleJel.Validator.lengthRange("word", { lower: 2, upper: 5, inclusive: false } ); // true Jel.Validator.lengthRange("word", { lower: 2, upper: 4, inclusive: false } ); // false Jel.Validator.lengthRange("word", { lower: 2, upper: 4, inclusive: true } ); // true Jel.Validator.lengthRange("wo", { lower: 3, upper: 8, inclusive: false } ); // false
intTypechecks if a string value represents a positive or negative integer Arguments| value | string, the string to check |
Returns| { value: integer } | an object hash containing the integer value of the string, if condition is met | | false | otherwise |
ExampleJel.Validator.int("4"); // { value: 4 } Jel.Validator.int("word"); // false
See AlsointPositive, intNegative
intPositive| intPositive: function( | value | ) |
|
checks if a string value represents a positive integer Arguments| value | string, the string to c heck |
Returns| { value: integer } | an object hash containing the integer value of the string, if condition is met | | false | otherwise |
ExampleJel.Validator.int_positive("4"); // { value: 4 } Jel.Validator.int_positive("-4"); // false
See Also<int>, intNegative
intNegative| intNegative: function( | value | ) |
|
checks if a string value represents a negative integer Arguments| value | string, the string to check |
Returns| { value: integer } | an object hash containing the integer value of the string, if condition is met | | false | otherwise |
ExampleJel.Validator.intNegative("4"); // false Jel.Validator.intNegative("-4"); // { value: -4 }
See Also<int>, intPositive
floatType| floatType: function( | value | ) |
|
checks if a string value represents a positive or negative float Arguments| value | string, the string to check |
Returns| { value: float } | an object hash containing the float value of the string, if condition is met | | false | otherwise |
ExampleJel.Validator.float("4.5"); // { value: 4.5 } Jel.Validator.float("word"); // false Jel.Validator.float("4"); // false
See AlsofloatPositive, floatNegative
floatPositive| floatPositive: function( | value | ) |
|
checks if a string value represents a positive float Arguments| value | string, the string to check |
Returns| { value: float } | an object hash containing the float value of the string, if condition is met | | false | otherwise |
ExampleJel.Validator.floatPositive("4.5"); // { value: 4.5 } Jel.Validator.floatPositive("word"); // false Jel.Validator.floatPositive("-4.5"); // false
See Also<float>, floatNegative
floatNegative| floatNegative: function( | value | ) |
|
checks if a string value represents a negative float Arguments| value | string, the string to check |
Returns| { value: float } | an object hash containing the float value of the string, if condition is met | | false | otherwise |
ExampleJel.Validator.floatNegative("4.5"); // false Jel.Validator.floatNegative("word"); // false Jel.Validator.floatNegative("-4.5"); // { value: -4.5 }
See Also<float>, floatPositive
numericType| numericType: function( | value | ) |
|
checks if a string value represents a positive or negative float or integer Arguments| value | string, the string to check |
Returns| { value: float OR integer } | an object hash containing the float OR integer value of the string, if condition is met | | false | otherwise |
ExampleJel.Validator.numericType("4.5"); // { value: 4.5 } Jel.Validator.numericType("word"); // false Jel.Validator.numericType("-4"); // { value: -4 } Jel.Validator.numericType("-4.0"); // { value: -4.0 }
numericPositive| numericPositive: function( | value | ) |
|
checks if a string value represents a positive float or integer Arguments| value | string, the string to check |
Returns| { value: float OR integer } | an object hash containing the float OR integer value of the string, if condition is met | | false | otherwise |
ExampleJel.Validator.numericPositive("4.5"); // { value: 4.5 } Jel.Validator.numericPositive("85"); // { value: 85 } Jel.Validator.numericPositive("word"); // false Jel.Validator.numericPositive("-4"); // false Jel.Validator.numericPositive("-4.0"); // false
numericNegative| numericNegative: function( | value | ) |
|
checks if a string value represents a negative float or integer Arguments| value | string, the string to check |
Returns| { value: float OR integer } | an object hash containing the float OR integer value of the string, if condition is met | | false | otherwise |
ExampleJel.Validator.numericNegative("-4.5"); // { value: -4.5 } Jel.Validator.numericNegative("word"); // false Jel.Validator.numericNegative("-4"); // { value: -4 } Jel.Validator.numericNegative("4.0"); // false
dateType| dateType: function( | value, | | info | ) |
|
checks if a string value represents a date in a specified format. The date must also be valid within the Gregorian calendar Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| format | a string describing the format of the date (see <Date.prototype.format> for more details) |
ExampleJel.Validator.dateType("28/03/2006", { format: "d/m/Y" } ); // { value: [date object, day=28, month=2, year=2006] } Jel.Validator.dateType("31/02/2006", { format: "d/m/Y" } ); // false (not a real date) Jel.Validator.dateType("cool", { format: "d/m/Y" } ); // false
emailchecks if a string value represents a valid email address Arguments| value | string, the string to check |
Returns| { value: string } | an object hash containing the provided value, if condition is met | | false | otherwise |
ExampleJel.Validator.email("tom"); // false Jel.Validator.email("tom@domain.com"); // { value: "tom@domain.com" } Jel.Validator.email("tom@domain."); // false Jel.Validator.email("4"); // false
range| range: function( | value, | | info | ) |
|
checks if a string value falls within a given range, assuming a specific type (and format if the type is a date) Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info Hash Properties| lower | the lower bound of the range to check | | upper | the upper bound of the range to check | | type (optional) | the data type to convert to in the comparisons (“int”, “float”, or “date”). If not specified a string comparison is performed | | format (optional) | if type is a date, describes the input format (see <Date.prototype.format> for more details) | | inclusive (optional) | whether the comparison includes the lower and upper bounds. Assumed to be true if not specified |
Returns| object | a hash containing the native value of the string provided based on the type specified, if the comparison is true { value: [typed-value] } | | false | otherwise |
Example Jel.Validator.range("28/03/2006", { type: "date", lower: "23/02/2006", upper: "24/06/2006", format: "d/m/Y" } ); // { value: [date object, day=28, month=3, year=2006] }
Jel.Validator.range("5", { type: "int", lower: "4", upper: "8" } ); // { value: 5 }
rangeCi| rangeCi: function( | value, | | info | ) |
|
checks if a string value falls within a given range, assuming a specific type (and format if the type is a date), and is case insensitive if type is string Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info Hash Properies| lower | the lower bound of the range to check | | upper | the upper bound of the range to check | | type (optional) | the data type to convert to in the comparisons (“int”, “float”, or “date”). If not specified a string comparison is performed | | format (optional) | if type is a date, describes the input format (see <Date.prototype.format> for more details) | | inclusive (optional) | whether the comparison includes the lower and upper bounds. Assumed to be true if not specified |
Returns| object | a hash containing the native value of the string provided based on the type specified, if the comparison is true { value: [typed-value] } | | false | otherwise |
Example Jel.Validator.rangeCi("28/03/2006", { type: "date", lower: "23/02/2006", upper: "24/06/2006", format: "d/m/Y" } ); // { value: [date object, day=28, month=3, year=2006] }
Jel.Validator.rangeCi("5", { type: "int", lower: "4", upper: "8" } ); // { value: 5 }
eqchecks if a string value is equal to another, assuming a specific type (and format if the type is a date) Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to | | type (optional) | the data type to convert to in the comparisons (“int”, “float”, or “date”). If not specified a string comparison is performed | | format (optional) | if type is a date, describes the input format (see <Date.prototype.format> for more details) |
Returns| object | a hash containing the native value of the string provided based on the type specified, if the comparison is true { value: [typed-value] } | | false | otherwise |
ExampleJel.Validator.eq("5", { type: "int", compare: "5" } ) // { value: 5 }
eqCi| eqCi: function( | value, | | info | ) |
|
checks if a string value is equal to another, assuming a specific type (and format if the type is a date), and is case insensitive if type is string Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to | | type (optional) | the data type to convert to in the comparisons (“int”, “float”, or “date”). If not specified a string comparison is performed | | format (optional) | if type is a date, describes the input format (see <Date.prototype.format> for more details) |
Returns| object | a hash containing the native value of the string provided based on the type specified, if the comparison is true { value: [typed-value] } | | false | otherwise |
ExampleJel.Validator.eqCi("CAR", { compare: "car" } ); // { value: "car" }
neq| neq: function( | value, | | info | ) |
|
checks if a string value is not equal to another, assuming a specific type (and format if the type is a date) Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to | | type (optional) | the data type to convert to in the comparisons (“int”, “float”, or “date”). If not specified a string comparison is performed | | format (optional) | if type is a date, describes the input format (see <Date.prototype.format> for more details) |
Returns| object | a hash containing the native value of the string provided based on the type specified, if the comparison is true { value: [typed-value] } | | false | otherwise |
ExampleJel.Validator.neq("5", { type: "int", compare: "6" } ); // { value: 5 }
neqCi| neqCi: function( | value, | | info | ) |
|
checks if a string value is not equal to another, assuming a specific type (and format if the type is a date), and is case insensitive if type is string Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to | | type (optional) | the data type to convert to in the comparisons (“int”, “float”, or “date”). If not specified a string comparison is performed | | format (optional) | if type is a date, describes the input format (see <Date.prototype.format> for more details) |
Returns| object | a hash containing the native value of the string provided based on the type specified, if the comparison is true { value: [typed-value] } | | false | otherwise |
ExampleJel.Validator.neqCi("5", { type: "int", compare: "6" } ); // { value: 5 }
gtchecks if a string value is greater than another, assuming a specific type (and format if the type is a date) Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to | | type (optional) | the data type to convert to in the comparisons (“int”, “float”, or “date”). If not specified a string comparison is performed | | inclusive (optional) | whether the comparison includes the comparison value. In this case, assumed to be false if not specified | | format (optional) | if type is a date, describes the input format (see <Date.prototype.format> for more details) |
Returns| object | a hash containing the native value of the string provided based on the type specified, if the comparison is true { value: [typed-value] } | | false | otherwise |
ExampleJel.Validator.gt("5", { type: "int", compare: "4" } ); // { value: 5 }
Jel.Validator.gt("5", { type: "int", compare: "5" } ); // false
Jel.Validator.gt("5", { type: "int", compare: "5", inclusive: true } ); // { value: 5 }
gtCi| gtCi: function( | value, | | info | ) |
|
checks if a string value is greater than another, assuming a specific type (and format if the type is a date), and is case insensitive if type is string Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to | | type (optional) | the data type to convert to in the comparisons (“int”, “float”, or “date”). If not specified a string comparison is performed | | inclusive (optional) | whether the comparison includes the comparison value. In this case, assumed to be false if not specified | | format (optional) | if type is a date, describes the input format (see <Date.prototype.format> for more details) |
Returns| object | a hash containing the native value of the string provided based on the type specified, if the comparison is true { value: [typed-value] } | | false | otherwise |
ExampleJel.Validator.gtCi("5", { type: "int", compare: "4" } ); // { value: 5 }
Jel.Validator.gtCi("5", { type: "int", compare: "5" } ); // false
Jel.Validator.gtCi("5", { type: "int", compare: "5", inclusive: true } ); // { value: 5 }
ltchecks if a string value is less than another, assuming a specific type (and format if the type is a date). Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to | | type (optional) | the data type to convert to in the comparisons (“int”, “float”, or “date”). If not specified a string comparison is performed | | inclusive (optional) | whether the comparison includes the comparison value. In this case, assumed to be false if not specified | | format (optional) | if type is a date, describes the input format (see <Date.prototype.format> for more details) |
Returns| object | a hash containing the native value of the string provided based on the type specified, if the comparison is true { value: [typed-value] } | | false | otherwise |
ExampleJel.Validator.lt("5", { type: "int", compare: "6" } ); // { value: 5 }
Jel.Validator.lt("6", { compare: "45" } ); // false (character comparison)
Jel.Validator.lt("5", { type: "int", compare: "5" } ); // false
Jel.Validator.lt("5", { type: "int", compare: "5", inclusive: true } ); // { value: 5 }
ltCi| ltCi: function( | value, | | info | ) |
|
checks if a string value is less than another, assuming a specific type (and format if the type is a date), and is case insensitive if type is string Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to | | type (optional) | the data type to convert to in the comparisons (“int”, “float”, or “date”). If not specified a string comparison is performed | | inclusive (optional) | whether the comparison includes the comparison value. In this case, assumed to be false if not specified | | format (optional) | if type is a date, describes the input format (see <Date.prototype.format> for more details) |
Returns| object | a hash containing the native value of the string provided based on the type specified, if the comparison is true { value: [typed-value] } | | false | otherwise |
ExampleJel.Validator.ltCi("5", { type: "int", compare: "6" } ); // { value: 5 }
Jel.Validator.ltCi("6", { compare: "45" } ); // false (character comparison)
Jel.Validator.ltCi("5", { type: "int", compare: "5" } ); // false
Jel.Validator.ltCi("5", { type: "int", compare: "5", inclusive: true } ); // { value: 5 }
gechecks if a string value is greater than or equal to another, assuming a specific type (and format if the type is a date) Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to | | type (optional) | the data type to convert to in the comparisons (“int”, “float”, or “date”). If not specified a string comparison is performed | | format (optional) | if type is a date, describes the input format (see <Date.prototype.format> for more details) |
Returns| object | a hash containing the native value of the string provided based on the type specified, if the comparison is true { value: [typed-value] } | | false | otherwise |
ExampleJel.Validator.ge("7", { type: "int", compare: "6" } ); // { value: 7 } Jel.Validator.ge("5", { type: "int", compare: "5" } ); // { value: 5 } Jel.Validator.ge("5", { type: "int", compare: "7" } ); // false
geCi| geCi: function( | value, | | info | ) |
|
checks if a string value is greater than or equal to another, assuming a specific type (and format if the type is a date), and is case insensitive if type is string Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to | | type (optional) | the data type to convert to in the comparisons (“int”, “float”, or “date”). If not specified a string comparison is performed | | format (optional) | if type is a date, describes the input format (see <Date.prototype.format> for more details) |
Returns| object | a hash containing the native value of the string provided based on the type specified, if the comparison is true { value: [typed-value] } | | false | otherwise |
ExampleJel.Validator.geCi("7", { type: "int", compare: "6" } ); // { value: 7 } Jel.Validator.geCi("5", { type: "int", compare: "5" } ); // { value: 5 } Jel.Validator.geCi("5", { type: "int", compare: "7" } ); // false
lechecks if a string value is less than or equal to another, assuming a specific type (and format if the type is a date) Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to | | type (optional) | the data type to convert to in the comparisons (“int”, “float”, or “date”). If not specified a string comparison is performed | | format (optional) | if type is a date, describes the input format (see <Date.prototype.format> for more details) |
Returns| object | a hash containing the native value of the string provided based on the type specified, if the comparison is true { value: [typed-value] } | | false | otherwise |
ExampleJel.Validator.le("5", { type: "int", compare: "6" } ); // { value: 5 } Jel.Validator.le("5", { type: "int", compare: "5" } ); // { value: 5 } Jel.Validator.le("5", { type: "int", compare: "4" } ); // false
leCi| leCi: function( | value, | | info | ) |
|
checks if a string value is less than or equal to another, assuming a specific type (and format if the type is a date), and is case insensitive if type is string Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to | | type (optional) | the data type to convert to in the comparisons (“int”, “float”, or “date”). If not specified a string comparison is performed | | format (optional) | if type is a date, describes the input format (see <Date.prototype.format> for more details) |
Returns| object | a hash containing the native value of the string provided based on the type specified, if the comparison is true { value: [typed-value] } | | false | otherwise |
ExampleJel.Validator.leCi("5", { type: "int", compare: "6" } ); // { value: 5 } Jel.Validator.leCi("5", { type: "int", compare: "5" } ); // { value: 5 } Jel.Validator.leCi("5", { type: "int", compare: "4" } ); // false
intEq| intEq: function( | value, | | info | ) |
|
checks if a string value is equal to another, comparing both as integers Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to |
Returns| object | a hash containing the integer value of the string, if the comparison is true { value: [typed-value] }, and the values are both integers | | false | otherwise |
ExampleJel.Validator.eq("5", { compare: "5" } ); // { value: 5 } Jel.Validator.eq("4", { compare: "5" } ); // false
intNeq| intNeq: function( | value, | | info | ) |
|
checks if a string value is not equal to another, comparing both as integers Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to |
Returns| object | a hash containing the integer value of the string, if the comparison is true { value: [typed-value] }, and the values are both integers | | false | otherwise |
ExampleJel.Validator.neq("5", { compare: "5" } ); // false Jel.Validator.neq("4", { compare: "5" } ); // { value: 4 }
intLt| intLt: function( | value, | | info | ) |
|
checks if a string value is less than another, comparing both as integers Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to | | inclusive (optional) | whether the comparison includes the comparison value. In this case, assumed to be false if not specified |
Returns| object | a hash containing the integer value of the string, if the comparison is true { value: [typed-value] }, and the values are both integers | | false | otherwise |
ExampleJel.Validator.intLt("5", { compare: "6" } ); // { value: 5 } Jel.Validator.intLt("4", { compare: "3" } ); // false
intGt| intGt: function( | value, | | info | ) |
|
checks if a string value is greater than another, comparing both as integers Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to | | inclusive (optional) | whether the comparison includes the comparison value. In this case, assumed to be false if not specified |
Returns| object | a hash containing the integer value of the string, if the comparison is true { value: [typed-value] }, and the values are both integers | | false | otherwise |
ExampleJel.Validator.intGt("5", { compare: "5" } ); // false Jel.Validator.intGt("5", { compare: "4" } ); { value: 5 }
intLe| intLe: function( | value, | | info | ) |
|
checks if a string value is less than or equal to another, comparing both as integers Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to |
Returns| object | a hash containing the integer value of the string, if the comparison is true { value: [typed-value] }, and the values are both integers | | false | otherwise |
ExampleJel.Validator.intLe("5", { compare: "5" } ); // { value: 5 } Jel.Validator.intLe("4", { compare: "3" } ); // false
intGe| intGe: function( | value, | | info | ) |
|
checks if a string value is greater than or equal to another, comparing both as integers Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to |
Returns| object | a hash containing the integer value of the string, if the comparison is true { value: [typed-value] }, and the values are both integers | | false | otherwise |
ExampleJel.Validator.intGe("5", { compare: "5" } ); // { value: 5 } Jel.Validator.intGe("2", { compare: "3" } ); // false
intRange| intRange: function( | value, | | info | ) |
|
checks if a string value falls within a given range, comparing as integers Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| lower | the lower bound of the range to check | | upper | the upper bound of the range to check | | inclusive (optional) | whether the comparison includes the lower and upper bounds. Assumed to be true if not specified |
Returns| object | a hash containing the native value of the string provided based on the type specified, if the comparison is true { value: [typed-value] } | | false | otherwise |
ExampleJel.Validator.intRange("3", { lower: "5", upper: "7" } ); // false Jel.Validator.intRange("5", { lower: "4", upper: "8" } ); // { value: 5 }
floatEq| floatEq: function( | value, | | info | ) |
|
checks if a string value is equal to another, comparing both as floats Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to |
Returns| object | a hash containing the float value of the string, if the comparison is true { value: [typed-value] }, and the values are both floats | | false | otherwise |
Example Jel.Validator.floatEq("5", { compare: "5.0" } ); // { value: 5.0 }
Jel.Validator.floatEq("4", { compare: "5.0" } ); // false
floatNeq| floatNeq: function( | value, | | info | ) |
|
checks if a string value is not equal to another, comparing both as floats Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to |
Returns| object | a hash containing the float value of the string, if the comparison is true { value: [typed-value] }, and the values are both floats | | false | otherwise |
Example Jel.Validator.floatNeq("5", { compare: "5.0" } ); // false
Jel.Validator.floatNeq("4", { compare: "5.0" } ); // { value: 4.0 }
floatLt| floatLt: function( | value, | | info | ) |
|
checks if a string value is less than another, comparing both as floats Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to | | inclusive (optional) | whether the comparison includes the comparison value. In this case, assumed to be false if not specified |
Returns| object | a hash containing the float value of the string, if the comparison is true { value: [typed-value] }, and the values are both floats | | false | otherwise |
ExampleJel.Validator.floatLt("5", { compare: "6.0" } ); // { value: 5.0 } Jel.Validator.floatLt("4", { compare: "3.0" } ); // false
floatGt| floatGt: function( | value, | | info | ) |
|
checks if a string value is greater than another, comparing both as floats Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to | | inclusive (optional) | whether the comparison includes the comparison value. In this case, assumed to be false if not specified |
Returns| object | a hash containing the float value of the string, if the comparison is true { value: [typed-value] }, and the values are both floats | | false | otherwise |
ExampleJel.Validator.floatGt("5.0", { compare: "5.0" } ); // false Jel.Validator.floatGt("5.0", { compare: "4.0" } ); { value: 5.0 }
floatLe| floatLe: function( | value, | | info | ) |
|
checks if a string value is less than or equal to another, comparing both as floats Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to |
Returns| object | a hash containing the float value of the string, if the comparison is true { value: [typed-value] }, and the values are both floats | | false | otherwise |
ExampleJel.Validator.floatLe("5.0", { compare: "5.0" } ); // { value: 5.0 } Jel.Validator.floatLe("4.2", { compare: "3.0" } ); // false
floatGe| floatGe: function( | value, | | info | ) |
|
checks if a string value is greater than or equal to another, comparing both as floats Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to |
Returns| object | a hash containing the float value of the string, if the comparison is true { value: [typed-value] }, and the values are both floats | | false | otherwise |
ExampleJel.Validator.floatGe("5.0", { compare: "5.0" } ); // { value: 5.0 } Jel.Validator.floatGe("2.0", { compare: "3.0" } ); // false
floatRange| floatRange: function( | value, | | info | ) |
|
checks if a string value falls within a given range, comparing as floats Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| lower | the lower bound of the range to check | | upper | the upper bound of the range to check | | inclusive (optional) | whether the comparison includes the lower and upper bounds. Assumed to be true if not specified |
Returns| object | a hash containing the native value of the string provided based on the type specified, if the comparison is true { value: [typed-value] } | | false | otherwise |
ExampleJel.Validator.floatRange("3.0", { lower: "5.0", upper: "7.0" } ); // false Jel.Validator.floatRange("5.0", { lower: "4.0", upper: "8.0" } ); // { value: 5.0 }
numericEq| numericEq: function( | value, | | info | ) |
|
checks if a string value is equal to another, comparing both as numeric (float or integer) Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to |
Returns| object | a hash containing the date value of the string, if the comparison is true { value: [typed-value] }, and the values are both dates | | false | otherwise |
ExampleJel.Validator.numericEq("5", { compare: "5.0" } ); // { value: 5.0 } Jel.Validator.numericEq("4", { compare: "5.0" } ); // false
numericNeq| numericNeq: function( | value, | | info | ) |
|
checks if a string value is not equal to another, comparing both as numeric (float or integer) Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to |
Returns| object | a hash containing the date value of the string, if the comparison is true { value: [typed-value] }, and the values are both dates | | false | otherwise |
ExampleJel.Validator.numericNeq("5", { compare: "5.0" } ); // false Jel.Validator.numericNeq("4", { compare: "5.0" } ); // { value: 4.0 }
numericLt| numericLt: function( | value, | | info | ) |
|
checks if a string value is less than another, comparing both as numeric (float or integer) Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to | | inclusive (optional) | whether the comparison includes the comparison value. In this case, assumed to be false if not specified |
Returns| object | a hash containing the numeric value of the string, if the comparison is true { value: [typed-value] }, and the values are both numeric (float or integer) | | false | otherwise |
ExampleJel.Validator.numericLt("5", { compare: "6.0" } ); // { value: 5.0 } Jel.Validator.numericLt("4", { compare: "3.0" } ); // false
numericGt| numericGt: function( | value, | | info | ) |
|
checks if a string value is greater than another, comparing both as numeric (float or integer) Arguments| value | string, the string to check | | info | object hash, required (see below) |
Info hash Properties| compare | the value to compare to | | inclusive (optional) | whether the comparison includes the comparison value. In this case, assumed to be false if not specified |
Returns| object | a hash containing the numeric value of the string, if the comparison is true { value: [typed-value] }, and the values are both numeric (float or integer) | | false | otherwise |
ExampleJel.Validator.numericGt("5.0", { compare: "5.0" } ); // false Jel.Validator.numericGt("5.0", { compare: "4.0" } ); { value: 5.0 }
|