isAlpha.js 680 B

12345678910111213141516171819202122232425
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = isAlpha;
  6. var _assertString = require('./util/assertString');
  7. var _assertString2 = _interopRequireDefault(_assertString);
  8. var _alpha = require('./alpha');
  9. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10. function isAlpha(str) {
  11. var locale = arguments.length <= 1 || arguments[1] === undefined ? 'en-US' : arguments[1];
  12. (0, _assertString2.default)(str);
  13. if (locale in _alpha.alpha) {
  14. return _alpha.alpha[locale].test(str);
  15. }
  16. throw new Error('Invalid locale \'' + locale + '\'');
  17. }
  18. module.exports = exports['default'];