summaryrefslogtreecommitdiff
path: root/src/node_modules/validator/es/lib/isNumeric.js
blob: b87bfad1a7919ff2d333d8577e21125ee8c9e0ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import assertString from './util/assertString';
var numeric = /^[+-]?([0-9]*[.])?[0-9]+$/;
var numericNoSymbols = /^[0-9]+$/;
export default function isNumeric(str, options) {
  assertString(str);

  if (options && options.no_symbols) {
    return numericNoSymbols.test(str);
  }

  return numeric.test(str);
}