isAlphanumeric.js 738 B

123456789101112131415161718192021222324252627
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = isAlphanumeric;
  6. exports.locales = void 0;
  7. var _assertString = _interopRequireDefault(require("./util/assertString"));
  8. var _alpha = require("./alpha");
  9. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10. function isAlphanumeric(str) {
  11. var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-US';
  12. (0, _assertString.default)(str);
  13. if (locale in _alpha.alphanumeric) {
  14. return _alpha.alphanumeric[locale].test(str);
  15. }
  16. throw new Error("Invalid locale '".concat(locale, "'"));
  17. }
  18. var locales = Object.keys(_alpha.alphanumeric);
  19. exports.locales = locales;