isNumeric.js 623 B

1234567891011121314151617181920212223242526
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = isNumeric;
  6. var _assertString = _interopRequireDefault(require("./util/assertString"));
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. var numeric = /^[+-]?([0-9]*[.])?[0-9]+$/;
  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 numeric.test(str);
  16. }
  17. module.exports = exports.default;
  18. module.exports.default = exports.default;