This commit is contained in:
+67
-15
@@ -1,23 +1,75 @@
|
||||
import { customAlphabet } from 'nanoid'
|
||||
import { customAlphabet } from 'nanoid';
|
||||
|
||||
const ADJECTIVES = [
|
||||
'drunken', 'sleepy', 'grumpy', 'jolly', 'quiet', 'brave', 'clever', 'eager',
|
||||
'fuzzy', 'gentle', 'happy', 'icy', 'jumpy', 'kind', 'lively', 'mighty',
|
||||
'noisy', 'orange', 'proud', 'quick', 'rusty', 'silly', 'tidy', 'upbeat',
|
||||
'vivid', 'witty', 'zesty', 'bold', 'calm', 'dizzy',
|
||||
]
|
||||
'drunken',
|
||||
'sleepy',
|
||||
'grumpy',
|
||||
'jolly',
|
||||
'quiet',
|
||||
'brave',
|
||||
'clever',
|
||||
'eager',
|
||||
'fuzzy',
|
||||
'gentle',
|
||||
'happy',
|
||||
'icy',
|
||||
'jumpy',
|
||||
'kind',
|
||||
'lively',
|
||||
'mighty',
|
||||
'noisy',
|
||||
'orange',
|
||||
'proud',
|
||||
'quick',
|
||||
'rusty',
|
||||
'silly',
|
||||
'tidy',
|
||||
'upbeat',
|
||||
'vivid',
|
||||
'witty',
|
||||
'zesty',
|
||||
'bold',
|
||||
'calm',
|
||||
'dizzy',
|
||||
];
|
||||
|
||||
const NOUNS = [
|
||||
'wizard', 'tiger', 'otter', 'falcon', 'penguin', 'dragon', 'panda', 'raven',
|
||||
'walrus', 'yeti', 'badger', 'comet', 'ember', 'fox', 'goose', 'heron',
|
||||
'igloo', 'jackal', 'koala', 'lemur', 'mango', 'newt', 'oasis', 'puffin',
|
||||
'quokka', 'robin', 'sloth', 'toucan', 'unicorn', 'viper',
|
||||
]
|
||||
'wizard',
|
||||
'tiger',
|
||||
'otter',
|
||||
'falcon',
|
||||
'penguin',
|
||||
'dragon',
|
||||
'panda',
|
||||
'raven',
|
||||
'walrus',
|
||||
'yeti',
|
||||
'badger',
|
||||
'comet',
|
||||
'ember',
|
||||
'fox',
|
||||
'goose',
|
||||
'heron',
|
||||
'igloo',
|
||||
'jackal',
|
||||
'koala',
|
||||
'lemur',
|
||||
'mango',
|
||||
'newt',
|
||||
'oasis',
|
||||
'puffin',
|
||||
'quokka',
|
||||
'robin',
|
||||
'sloth',
|
||||
'toucan',
|
||||
'unicorn',
|
||||
'viper',
|
||||
];
|
||||
|
||||
const nanoid = customAlphabet('0123456789abcdefghijklmnopqrstuvwxyz', 6)
|
||||
const nanoid = customAlphabet('0123456789abcdefghijklmnopqrstuvwxyz', 6);
|
||||
|
||||
export function generateSlug(): string {
|
||||
const adjective = ADJECTIVES[Math.floor(Math.random() * ADJECTIVES.length)]
|
||||
const noun = NOUNS[Math.floor(Math.random() * NOUNS.length)]
|
||||
return `${adjective}-${noun}-${nanoid()}`
|
||||
const adjective = ADJECTIVES[Math.floor(Math.random() * ADJECTIVES.length)];
|
||||
const noun = NOUNS[Math.floor(Math.random() * NOUNS.length)];
|
||||
return `${adjective}-${noun}-${nanoid()}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user