my-notes-viewer/api/hooks/lib/helper.js

15 lines
247 B
JavaScript

const generateUrlString = (text) => {
if (text) {
return text
.replace(/[^a-zA-Z0-9 \/]/g, "")
.replace(/\s/g, "-")
.toLowerCase()
}
return ""
}
module.exports = {
generateUrlString,
}