feat: awesome ipfs website

This commit is contained in:
Henrique Dias 2018-04-23 15:22:21 +01:00
parent b26e566cb0
commit 5304c279f5
43 changed files with 1068 additions and 161 deletions

31
scripts/utils.js Normal file
View 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
}