2018-04-06 14:51:52 +01:00
|
|
|
exports.dasherize = function dasherize(name) {
|
|
|
|
return ('' + name)
|
|
|
|
.toLowerCase()
|
|
|
|
.replace(/\s/g, '-')
|
|
|
|
.replace(/[^a-z0-9\-\.]/gi, '')
|
2018-04-16 12:04:25 +01:00
|
|
|
.replace(/\./g, '-')
|
2018-04-06 14:51:52 +01:00
|
|
|
.replace(/\:/g, '');
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.nameify = function nameify(str) {
|
|
|
|
return ('' + str).replace(/[^a-zA-Z0-9\s]/g, '').replace(/\:/g, '');
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.unDasherize = function unDasherize(name) {
|
|
|
|
return (
|
|
|
|
('' + name)
|
|
|
|
// replace dash with space
|
|
|
|
.replace(/\-/g, ' ')
|
|
|
|
// strip nonalphanumarics chars except whitespace
|
|
|
|
.replace(/[^a-zA-Z\d\s]/g, '')
|
|
|
|
.trim()
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.descriptionRegex = /\<blockquote|\<ol|\<h4|\<table/;
|