mirror of
https://github.com/array-in-a-matrix/public-apis.git
synced 2025-04-02 11:11:50 -04:00
11 lines
297 B
JavaScript
11 lines
297 B
JavaScript
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, '-'),
|
|
}))
|
|
}
|