2019-09-25 20:16:08 +02:00
|
|
|
exports.dasherize = function dasherize(name) {
|
|
|
|
return ('' + name)
|
|
|
|
.toLowerCase()
|
|
|
|
.replace(/\s/g, '-')
|
2019-09-26 16:27:26 +02:00
|
|
|
.replace(/[^a-z\d\-.]/g, '');
|
2019-09-25 20:16:08 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
exports.nameify = function nameify(str) {
|
2019-09-26 16:27:26 +02:00
|
|
|
return ('' + str).replace(/[^a-z\d\s]/gi, '');
|
2019-09-25 20:16:08 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
exports.unDasherize = function unDasherize(name) {
|
|
|
|
return (
|
|
|
|
('' + name)
|
|
|
|
// replace dash with space
|
|
|
|
.replace(/-/g, ' ')
|
|
|
|
// strip nonalphanumarics chars except whitespace
|
2019-09-26 16:27:26 +02:00
|
|
|
.replace(/[^a-z\d\s]/gi, '')
|
2019-09-25 20:16:08 +02:00
|
|
|
.trim()
|
|
|
|
);
|
|
|
|
};
|