feat: Add DB
This commit is contained in:
11
utils/db/format-categories.js
Normal file
11
utils/db/format-categories.js
Normal file
@@ -0,0 +1,11 @@
|
||||
module.exports = function (categories) {
|
||||
return categories.map(category => ({
|
||||
name: category,
|
||||
slug: category
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
.replace(/&/g, 'and')
|
||||
.replace(/[^A-Z0-9/]+/gi, '-')
|
||||
.replace(/\s/g, '-'),
|
||||
}))
|
||||
}
|
||||
Reference in New Issue
Block a user