isSlug.js 522 B

1234567891011121314151617181920
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = isSlug;
  6. var _assertString = _interopRequireDefault(require("./util/assertString"));
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. var charsetRegex = /^[^\s-_](?!.*?[-_]{2,})[a-z0-9-\\][^\s]*[^-_\s]$/;
  9. function isSlug(str) {
  10. (0, _assertString.default)(str);
  11. return charsetRegex.test(str);
  12. }
  13. module.exports = exports.default;
  14. module.exports.default = exports.default;