How to use the isFloat function from validator
Find comprehensive JavaScript validator.isFloat code examples handpicked from public code repositorys.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
const validAlpha = url => validator.isAlpha(url); const validDecimal = url => validator.isDecimal(url); const validFloat = url => validator.isFloat(url); const validInt = url => validator.isInt(url); const validNumber = url => validator.isNumeric(url);
5
63
0
40 41 42 43 44 45 46 47 48 49
if (!_.isArray(value)) return false; return validator.isLongitude(value[0]) && validator.isLatitude(value[1]); }); validator.extend('isLatitude', (value) => validator.isFloat(value) && value >= -90 && value <= 90); validator.extend('isLongitude', (value) => validator.isFloat(value) && value >= -180 && value <= 180); const DATE_REGEX = { yyyymmdd: /^(19|20)[0-9][0-9]-([0][0-9]|1[0-2])-([0-2][0-9]|3[01])$/,
5
7
2
+ 7 other calls in file
104 105 106 107 108 109 110 111 112 113
} return true; }, isFloat: function(rule, value) { if (rule) { return validator.isFloat(value); } return true; }, isDivisibleBy: function(rule, value) {
0
2
2
+ 5 other calls in file
GitHub: justinsisley/marshall
231 232 233 234 235 236 237 238 239 240
case 'fqdn': isValid = validator.isFQDN(stringValue); break; case 'float': isValid = validator.isFloat(stringValue); break; case 'ip': isValid = validator.isIP(stringValue);
0
2
1
+ 31 other calls in file
59 60 61 62 63 64 65 66 67 68
}, // isFloat(str [, options]) - check if the string is a float. // options is an object which can contain the keys min and/or max to validate // the float is within boundaries (e.g. { min: 7.22, max: 9.55 }). isFloat: function (str, options) { return validator.isFloat(str, typeof options === 'object' ? options : undefined); }, // isFullWidth(str) - check if the string contains any full-width chars. isFullWidth: validator.isFullWidth, // isHalfWidth(str) - check if the string contains any half-width chars.
0
1
3
+ 17 other calls in file
GitHub: SubinY/koa-seed
324 325 326 327 328 329 330 331 332 333
if (typeof value === 'string') { this.parsedValue = validator1.toFloat(value); return validator1.isFloat(value, ...this.options); } else { this.parsedValue = value; return validator1.isFloat(String(value), ...this.options); } case 'isBoolean': if (typeof value === 'string') { this.parsedValue = validator1.toBoolean(value);
0
0
0
+ 7 other calls in file
113 114 115 116 117 118 119 120 121 122
* 检查字符串是否为float * @param str 输入字符串 * @param options 参数项 */ isFloat(str, options) { return validator1.isFloat(str, options); } /** * 检查number是否为float
0
0
0
+ 3 other calls in file
validator.escape is the most popular function in validator (548 examples)