summaryrefslogtreecommitdiffhomepage
path: root/packages/util/src/slug.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/util/src/slug.ts')
-rw-r--r--packages/util/src/slug.ts74
1 files changed, 74 insertions, 0 deletions
diff --git a/packages/util/src/slug.ts b/packages/util/src/slug.ts
new file mode 100644
index 000000000..62cf0e57b
--- /dev/null
+++ b/packages/util/src/slug.ts
@@ -0,0 +1,74 @@
+export namespace Slug {
+ const ADJECTIVES = [
+ "brave",
+ "calm",
+ "clever",
+ "cosmic",
+ "crisp",
+ "curious",
+ "eager",
+ "gentle",
+ "glowing",
+ "happy",
+ "hidden",
+ "jolly",
+ "kind",
+ "lucky",
+ "mighty",
+ "misty",
+ "neon",
+ "nimble",
+ "playful",
+ "proud",
+ "quick",
+ "quiet",
+ "shiny",
+ "silent",
+ "stellar",
+ "sunny",
+ "swift",
+ "tidy",
+ "witty",
+ ] as const
+
+ const NOUNS = [
+ "cabin",
+ "cactus",
+ "canyon",
+ "circuit",
+ "comet",
+ "eagle",
+ "engine",
+ "falcon",
+ "forest",
+ "garden",
+ "harbor",
+ "island",
+ "knight",
+ "lagoon",
+ "meadow",
+ "moon",
+ "mountain",
+ "nebula",
+ "orchid",
+ "otter",
+ "panda",
+ "pixel",
+ "planet",
+ "river",
+ "rocket",
+ "sailor",
+ "squid",
+ "star",
+ "tiger",
+ "wizard",
+ "wolf",
+ ] as const
+
+ export function create() {
+ return [
+ ADJECTIVES[Math.floor(Math.random() * ADJECTIVES.length)],
+ NOUNS[Math.floor(Math.random() * NOUNS.length)],
+ ].join("-")
+ }
+}