@workday/canvas-kit-react
Version:
The parent module that contains all Workday Canvas Kit React components
19 lines (18 loc) • 486 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.slugify = void 0;
/**
* Function that takes a string and returns a "slug" which can be used in HTML
*/
function slugify(input) {
return input
.trim()
.replace(/[\.\s_-]+/g, '-')
.replace(/[^\w\s-]/g, '')
.replace(/([A-Z])/g, m => {
return '-' + m.toLowerCase();
})
.replace(/^-+|-+$/g, '')
.toLowerCase();
}
exports.slugify = slugify;
;