isNumeric.js 719 B

123456789101112131415161718192021222324252627
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = isNumeric;
  6. var _assertString = _interopRequireDefault(require("./util/assertString"));
  7. var _alpha = require("./alpha");
  8. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9. var numericNoSymbols = /^[0-9]+$/;
  10. function isNumeric(str, options) {
  11. (0, _assertString.default)(str);
  12. if (options && options.no_symbols) {
  13. return numericNoSymbols.test(str);
  14. }
  15. return new RegExp("^[+-]?([0-9]*[".concat((options || {}).locale ? _alpha.decimal[options.locale] : '.', "])?[0-9]+$")).test(str);
  16. }
  17. module.exports = exports.default;
  18. module.exports.default = exports.default;