mirror of
https://github.com/seigler/awesome-dash-platform
synced 2025-07-27 06:36:08 +00:00
feat: awesome ipfs website
This commit is contained in:
parent
b26e566cb0
commit
5304c279f5
43 changed files with 1068 additions and 161 deletions
31
scripts/utils.js
Normal file
31
scripts/utils.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
const sort = (a, b) => {
|
||||
if (a < b) return -1
|
||||
if (a > b) return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
const sortInv = (a, b) => -sort(a, b)
|
||||
|
||||
const sortAbc = (a, b) => {
|
||||
a = a.toLowerCase()
|
||||
b = b.toLowerCase()
|
||||
return sort(a, b)
|
||||
}
|
||||
|
||||
const slugify = (text) => text.toString()
|
||||
.toLowerCase()
|
||||
.replace(/\s+/g, '-')
|
||||
.replace(/[^\w-]+/g, '')
|
||||
.replace(/--+/g, '-')
|
||||
.replace(/^-+/, '')
|
||||
.replace(/-+$/, '')
|
||||
|
||||
const capitalize = (text) => `${text.charAt(0).toUpperCase()}${text.slice(1).toLowerCase()}`
|
||||
|
||||
module.exports = {
|
||||
sort,
|
||||
sortInv,
|
||||
sortAbc,
|
||||
slugify,
|
||||
capitalize
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue