How to use the isCurrency function from validator

Find comprehensive JavaScript validator.isCurrency code examples handpicked from public code repositorys.

15
16
17
18
19
20
21
22
23
24
exports.isNumeric = function (value) {
  return validator.isNumeric(value) || validator.isDecimal(value)
}

exports.isCurrency = function (value) {
  return validator.isCurrency(value)
}

exports.isGreaterThanZero = function (value) {
  return value > 0
fork icon2
star icon5
watch icon35

157
158
159
160
161
162
163
164
165
166
  '^\\d+(' + units + ')+\\d*(' + units + ')*$',
  'i'
);

if (
  (ignoreCurrency && validator.isCurrency(word)) ||
  (ignoreEmail && validator.isEmail(word)) ||
  (ignoreFqdn && validator.isFQDN(word)) ||
  (ignoreUrl && validator.isURL(word)) ||
  (ignoreUnits && unitFilter.test(word))
fork icon0
star icon2
watch icon2

35
36
37
38
39
40
41
42
43
44
// allow_space_after_symbol: false, symbol_after_digits: false, allow_negatives: true,
// parens_for_negatives: false, negative_sign_before_digits: false,
// negative_sign_after_digits: false, allow_negative_sign_placeholder: false,
// thousands_separator: ',', decimal_separator: '.', allow_space_after_digits: false }.
isCurrency: function (str, options) {
  return validator.isCurrency(str, typeof options === 'object' ? options : {});
},
// isDate(str) - check if the string is a date.
isDate: validator.isDate,
// isDivisibleBy(str, number) - check if the string is a number that's divisible by another.
fork icon0
star icon1
watch icon3

+ 17 other calls in file

53
54
55
56
57
58
59
60
61
62
  method: 'isCurrency',
  message: 'currency format'
},
// check if the string is a credit card.
'currencywithsymbol': {
  method: (val) => V.isCurrency(val, { require_symbol: true }),
  message: 'currency format with currency symbol'
},
// check if the string is a (https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs)
'datauri': {
fork icon0
star icon0
watch icon0