isNumeric.js 400 B

123456789101112
  1. import assertString from './util/assertString';
  2. import { decimal } from './alpha';
  3. var numericNoSymbols = /^[0-9]+$/;
  4. export default function isNumeric(str, options) {
  5. assertString(str);
  6. if (options && options.no_symbols) {
  7. return numericNoSymbols.test(str);
  8. }
  9. return new RegExp("^[+-]?([0-9]*[".concat((options || {}).locale ? decimal[options.locale] : '.', "])?[0-9]+$")).test(str);
  10. }