1
0
Fork 0

wip(org): Working on admin & content creation pages

This commit is contained in:
joostdecock 2023-08-15 17:32:47 +02:00
parent 61da3e1dab
commit 50b6747584
26 changed files with 1221 additions and 3383 deletions

View file

@ -1,10 +1,25 @@
import tlds from 'tlds/index.json' assert { type: 'json' }
import _slugify from 'slugify'
import get from 'lodash.get'
import set from 'lodash.set'
import orderBy from 'lodash.orderby'
import unset from 'lodash.unset'
import { cloudflareConfig } from './config/cloudflare.mjs'
const slugifyConfig = {
replacement: '-', // replace spaces with replacement character, defaults to `-`
remove: undefined, // remove characters that match regex, defaults to `undefined`
lower: true, // convert to lower case, defaults to `false`
strict: true, // strip special characters except replacement, defaults to `false`
locale: 'en', // language code of the locale to use
trim: true, // trim leading and trailing replacement chars, defaults to `true`
}
// Slugify a string
export const slugify = (input) => _slugify(input, slugifyConfig)
// Slugify a string, but don't trim it. Handy when slugifying user input
export const slugifyNoTrim = (input) => _slugify(input, { ...slugifyConfig, trim: false })
// Method that returns a unique ID when all you need is an ID
// but you can't be certain you have one
export const getId = (id) => (id ? id : Date.now())