| 12345678910111213141516171819202122232425 |
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.slugify = void 0;
- // string.js slugify drops non ascii chars so we have to
- // use a custom implementation here
- const removeDiacritics = require('diacritics').remove;
- // eslint-disable-next-line no-control-regex
- const rControl = /[\u0000-\u001f]/g;
- const rSpecial = /[\s~`!@#$%^&*()\-_+=[\]{}|\\;:"'<>,.?/]+/g;
- exports.slugify = (str) => {
- return (removeDiacritics(str)
- // Remove control characters
- .replace(rControl, '')
- // Replace special characters
- .replace(rSpecial, '-')
- // Remove continous separators
- .replace(/\-{2,}/g, '-')
- // Remove prefixing and trailing separtors
- .replace(/^\-+|\-+$/g, '')
- // ensure it doesn't start with a number (#121)
- .replace(/^(\d)/, '_$1')
- // lowercase
- .toLowerCase());
- };
- //# sourceMappingURL=slugify.js.map
|