namejam 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +97 -0
- package/dist/cli.js +419 -0
- package/dist/index.cjs +338 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +19 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +337 -0
- package/dist/index.js.map +1 -0
- package/package.json +42 -0
- package/src/cli/index.ts +87 -0
- package/src/format.ts +36 -0
- package/src/generate.ts +56 -0
- package/src/index.ts +2 -0
- package/src/types.ts +25 -0
- package/src/words/adjectives.ts +82 -0
- package/src/words/nouns.ts +99 -0
- package/src/words/tech.ts +50 -0
- package/src/words/verbs.ts +32 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/words/adjectives.ts
|
|
3
|
+
const adjectives = [
|
|
4
|
+
"Accursed",
|
|
5
|
+
"Arcane",
|
|
6
|
+
"Befuddled",
|
|
7
|
+
"Bewildered",
|
|
8
|
+
"Blursed",
|
|
9
|
+
"Bogus",
|
|
10
|
+
"Caffeinated",
|
|
11
|
+
"Chaotic",
|
|
12
|
+
"Chunky",
|
|
13
|
+
"Cracked",
|
|
14
|
+
"Crunchy",
|
|
15
|
+
"Cryptic",
|
|
16
|
+
"Cursed",
|
|
17
|
+
"Damp",
|
|
18
|
+
"Deranged",
|
|
19
|
+
"Disheveled",
|
|
20
|
+
"Doomed",
|
|
21
|
+
"Elusive",
|
|
22
|
+
"Ethereal",
|
|
23
|
+
"Feral",
|
|
24
|
+
"Flummoxed",
|
|
25
|
+
"Flustered",
|
|
26
|
+
"Forbidden",
|
|
27
|
+
"Frantic",
|
|
28
|
+
"Furious",
|
|
29
|
+
"Glitchy",
|
|
30
|
+
"Gobsmacked",
|
|
31
|
+
"Goofy",
|
|
32
|
+
"Grumpy",
|
|
33
|
+
"Hapless",
|
|
34
|
+
"Haunted",
|
|
35
|
+
"Hollering",
|
|
36
|
+
"Invisible",
|
|
37
|
+
"Irate",
|
|
38
|
+
"Janky",
|
|
39
|
+
"Jittery",
|
|
40
|
+
"Klutzy",
|
|
41
|
+
"Lanky",
|
|
42
|
+
"Listless",
|
|
43
|
+
"Luminous",
|
|
44
|
+
"Lurking",
|
|
45
|
+
"Majestic",
|
|
46
|
+
"Maniacal",
|
|
47
|
+
"Manic",
|
|
48
|
+
"Mystical",
|
|
49
|
+
"Nefarious",
|
|
50
|
+
"Nervy",
|
|
51
|
+
"Notorious",
|
|
52
|
+
"Oblivious",
|
|
53
|
+
"Ominous",
|
|
54
|
+
"Ornery",
|
|
55
|
+
"Panicked",
|
|
56
|
+
"Peculiar",
|
|
57
|
+
"Phantom",
|
|
58
|
+
"Plucky",
|
|
59
|
+
"Prickly",
|
|
60
|
+
"Querulous",
|
|
61
|
+
"Rabid",
|
|
62
|
+
"Rambling",
|
|
63
|
+
"Reckless",
|
|
64
|
+
"Restless",
|
|
65
|
+
"Rogue",
|
|
66
|
+
"Scruffy",
|
|
67
|
+
"Smol",
|
|
68
|
+
"Sneaky",
|
|
69
|
+
"Snarky",
|
|
70
|
+
"Soggy",
|
|
71
|
+
"Spicy",
|
|
72
|
+
"Spooky",
|
|
73
|
+
"Suspicious",
|
|
74
|
+
"Tangled",
|
|
75
|
+
"Thunderous",
|
|
76
|
+
"Turbulent",
|
|
77
|
+
"Uncanny",
|
|
78
|
+
"Unhinged",
|
|
79
|
+
"Vexed",
|
|
80
|
+
"Volatile",
|
|
81
|
+
"Wacky",
|
|
82
|
+
"Wobbly",
|
|
83
|
+
"Zealous"
|
|
84
|
+
];
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/words/nouns.ts
|
|
87
|
+
const nouns = [
|
|
88
|
+
"Armadillo",
|
|
89
|
+
"Axolotl",
|
|
90
|
+
"Banshee",
|
|
91
|
+
"Basilisk",
|
|
92
|
+
"Blobfish",
|
|
93
|
+
"Boggart",
|
|
94
|
+
"Capybara",
|
|
95
|
+
"Chimera",
|
|
96
|
+
"Coyote",
|
|
97
|
+
"Cryptid",
|
|
98
|
+
"Ferret",
|
|
99
|
+
"Fetch",
|
|
100
|
+
"Flamingo",
|
|
101
|
+
"Gargoyle",
|
|
102
|
+
"Gecko",
|
|
103
|
+
"Goblin",
|
|
104
|
+
"Gremlin",
|
|
105
|
+
"Hedgehog",
|
|
106
|
+
"Imp",
|
|
107
|
+
"Jackalope",
|
|
108
|
+
"Kelpie",
|
|
109
|
+
"Kraken",
|
|
110
|
+
"Lemur",
|
|
111
|
+
"Mantis",
|
|
112
|
+
"Mongoose",
|
|
113
|
+
"Mothman",
|
|
114
|
+
"Narwhal",
|
|
115
|
+
"Okapi",
|
|
116
|
+
"Opossum",
|
|
117
|
+
"Pangolin",
|
|
118
|
+
"Penguin",
|
|
119
|
+
"Platypus",
|
|
120
|
+
"Poltergeist",
|
|
121
|
+
"Porcupine",
|
|
122
|
+
"Quokka",
|
|
123
|
+
"Raccoon",
|
|
124
|
+
"Revenant",
|
|
125
|
+
"Salamander",
|
|
126
|
+
"Specter",
|
|
127
|
+
"Tapir",
|
|
128
|
+
"Tardigrade",
|
|
129
|
+
"Thunderbird",
|
|
130
|
+
"Toad",
|
|
131
|
+
"Vulture",
|
|
132
|
+
"Walrus",
|
|
133
|
+
"Wendigo",
|
|
134
|
+
"Wombat",
|
|
135
|
+
"Wraith",
|
|
136
|
+
"Wyrm",
|
|
137
|
+
"Yak",
|
|
138
|
+
"Anomaly",
|
|
139
|
+
"Artifact",
|
|
140
|
+
"Bandit",
|
|
141
|
+
"Bauble",
|
|
142
|
+
"Biscuit",
|
|
143
|
+
"Blender",
|
|
144
|
+
"Burrito",
|
|
145
|
+
"Carbuncle",
|
|
146
|
+
"Cassette",
|
|
147
|
+
"Cauldron",
|
|
148
|
+
"Chalice",
|
|
149
|
+
"Cipher",
|
|
150
|
+
"Cloak",
|
|
151
|
+
"Contraption",
|
|
152
|
+
"Doohickey",
|
|
153
|
+
"Dumpling",
|
|
154
|
+
"Enigma",
|
|
155
|
+
"Fiasco",
|
|
156
|
+
"Gizmo",
|
|
157
|
+
"Grimoire",
|
|
158
|
+
"Harbinger",
|
|
159
|
+
"Lantern",
|
|
160
|
+
"Maverick",
|
|
161
|
+
"Menace",
|
|
162
|
+
"Monocle",
|
|
163
|
+
"Muffin",
|
|
164
|
+
"Noodle",
|
|
165
|
+
"Paradox",
|
|
166
|
+
"Parchment",
|
|
167
|
+
"Pickle",
|
|
168
|
+
"Pretzel",
|
|
169
|
+
"Relic",
|
|
170
|
+
"Rogue",
|
|
171
|
+
"Ruckus",
|
|
172
|
+
"Scroll",
|
|
173
|
+
"Sigil",
|
|
174
|
+
"Spatula",
|
|
175
|
+
"Talisman",
|
|
176
|
+
"Thingamajig",
|
|
177
|
+
"Toaster",
|
|
178
|
+
"Vagrant",
|
|
179
|
+
"Waffle",
|
|
180
|
+
"Warlock",
|
|
181
|
+
"Widget",
|
|
182
|
+
"Wizard"
|
|
183
|
+
];
|
|
184
|
+
//#endregion
|
|
185
|
+
//#region src/words/tech.ts
|
|
186
|
+
const tech = [
|
|
187
|
+
"Axiom",
|
|
188
|
+
"Axton",
|
|
189
|
+
"Byton",
|
|
190
|
+
"Cipher",
|
|
191
|
+
"Cyron",
|
|
192
|
+
"Daxon",
|
|
193
|
+
"Dexon",
|
|
194
|
+
"Draxon",
|
|
195
|
+
"Exon",
|
|
196
|
+
"Hexar",
|
|
197
|
+
"Hexon",
|
|
198
|
+
"Helix",
|
|
199
|
+
"Ionex",
|
|
200
|
+
"Kryox",
|
|
201
|
+
"Kronos",
|
|
202
|
+
"Kronox",
|
|
203
|
+
"Lyron",
|
|
204
|
+
"Matrix",
|
|
205
|
+
"Naxon",
|
|
206
|
+
"Neoron",
|
|
207
|
+
"Nexar",
|
|
208
|
+
"Nexon",
|
|
209
|
+
"Nexus",
|
|
210
|
+
"Omicron",
|
|
211
|
+
"Phazon",
|
|
212
|
+
"Photex",
|
|
213
|
+
"Photon",
|
|
214
|
+
"Praxon",
|
|
215
|
+
"Proton",
|
|
216
|
+
"Pulsar",
|
|
217
|
+
"Quantum",
|
|
218
|
+
"Quasar",
|
|
219
|
+
"Synthex",
|
|
220
|
+
"Synthos",
|
|
221
|
+
"Tachyon",
|
|
222
|
+
"Vector",
|
|
223
|
+
"Vertex",
|
|
224
|
+
"Vexar",
|
|
225
|
+
"Vexon",
|
|
226
|
+
"Vorex",
|
|
227
|
+
"Vorton",
|
|
228
|
+
"Vortex",
|
|
229
|
+
"Xaeon",
|
|
230
|
+
"Xyron",
|
|
231
|
+
"Zenon",
|
|
232
|
+
"Zephon",
|
|
233
|
+
"Zeron",
|
|
234
|
+
"Zython"
|
|
235
|
+
];
|
|
236
|
+
//#endregion
|
|
237
|
+
//#region src/words/verbs.ts
|
|
238
|
+
const verbs = [
|
|
239
|
+
"Banishing",
|
|
240
|
+
"Bumbling",
|
|
241
|
+
"Careening",
|
|
242
|
+
"Conjuring",
|
|
243
|
+
"Devouring",
|
|
244
|
+
"Enchanting",
|
|
245
|
+
"Fleeing",
|
|
246
|
+
"Fumbling",
|
|
247
|
+
"Glitching",
|
|
248
|
+
"Haunting",
|
|
249
|
+
"Howling",
|
|
250
|
+
"Jinxing",
|
|
251
|
+
"Lumbering",
|
|
252
|
+
"Lurking",
|
|
253
|
+
"Menacing",
|
|
254
|
+
"Napping",
|
|
255
|
+
"Obliterating",
|
|
256
|
+
"Pillaging",
|
|
257
|
+
"Questing",
|
|
258
|
+
"Rambling",
|
|
259
|
+
"Rampaging",
|
|
260
|
+
"Scheming",
|
|
261
|
+
"Shambling",
|
|
262
|
+
"Stampeding",
|
|
263
|
+
"Stumbling",
|
|
264
|
+
"Tinkering",
|
|
265
|
+
"Unleashing",
|
|
266
|
+
"Vanishing",
|
|
267
|
+
"Wobbling",
|
|
268
|
+
"Yelling"
|
|
269
|
+
];
|
|
270
|
+
//#endregion
|
|
271
|
+
//#region src/format.ts
|
|
272
|
+
function titleCase(word) {
|
|
273
|
+
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
274
|
+
}
|
|
275
|
+
function applyFormat(words, casing, separator, suffix) {
|
|
276
|
+
let result;
|
|
277
|
+
switch (casing) {
|
|
278
|
+
case "lowercase":
|
|
279
|
+
result = words.map((w) => w.toLowerCase()).join(separator);
|
|
280
|
+
break;
|
|
281
|
+
case "uppercase":
|
|
282
|
+
result = words.map((w) => w.toUpperCase()).join(separator);
|
|
283
|
+
break;
|
|
284
|
+
case "title":
|
|
285
|
+
result = words.map(titleCase).join(separator);
|
|
286
|
+
break;
|
|
287
|
+
case "pascal":
|
|
288
|
+
result = words.map(titleCase).join("");
|
|
289
|
+
break;
|
|
290
|
+
case "camel": {
|
|
291
|
+
const [first, ...rest] = words.map(titleCase);
|
|
292
|
+
result = (first ?? "").toLowerCase() + rest.join("");
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
return result + suffix;
|
|
297
|
+
}
|
|
298
|
+
//#endregion
|
|
299
|
+
//#region src/generate.ts
|
|
300
|
+
function pickUnique(arr, n) {
|
|
301
|
+
const copy = [...arr];
|
|
302
|
+
for (let i = 0; i < n; i++) {
|
|
303
|
+
const j = i + Math.floor(Math.random() * (copy.length - i));
|
|
304
|
+
[copy[i], copy[j]] = [copy[j], copy[i]];
|
|
305
|
+
}
|
|
306
|
+
return copy.slice(0, n);
|
|
307
|
+
}
|
|
308
|
+
function buildWords(style) {
|
|
309
|
+
switch (style) {
|
|
310
|
+
case "adj-noun": return [pickUnique(adjectives, 1)[0], pickUnique(nouns, 1)[0]];
|
|
311
|
+
case "adj-adj-noun": {
|
|
312
|
+
const [adj1, adj2] = pickUnique(adjectives, 2);
|
|
313
|
+
return [
|
|
314
|
+
adj1,
|
|
315
|
+
adj2,
|
|
316
|
+
pickUnique(nouns, 1)[0]
|
|
317
|
+
];
|
|
318
|
+
}
|
|
319
|
+
case "verb-noun": return [pickUnique(verbs, 1)[0], pickUnique(nouns, 1)[0]];
|
|
320
|
+
case "noun-noun": return pickUnique(nouns, 2);
|
|
321
|
+
case "adj-tech": return [pickUnique(adjectives, 1)[0], pickUnique(tech, 1)[0]];
|
|
322
|
+
case "tech": return [pickUnique(tech, 1)[0]];
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
function buildSuffix(digits) {
|
|
326
|
+
if (!digits) return "";
|
|
327
|
+
let s = "";
|
|
328
|
+
for (let i = 0; i < digits; i++) s += Math.floor(Math.random() * 10).toString();
|
|
329
|
+
return s;
|
|
330
|
+
}
|
|
331
|
+
function generateName(options = {}) {
|
|
332
|
+
const { style = "adj-noun", separator = "-", casing = "lowercase", suffix } = options;
|
|
333
|
+
return applyFormat(buildWords(style), casing, separator, buildSuffix(suffix));
|
|
334
|
+
}
|
|
335
|
+
//#endregion
|
|
336
|
+
exports.generateName = generateName;
|
|
337
|
+
|
|
338
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../src/words/adjectives.ts","../src/words/nouns.ts","../src/words/tech.ts","../src/words/verbs.ts","../src/format.ts","../src/generate.ts"],"sourcesContent":["export const adjectives: string[] = [\n \"Accursed\",\n \"Arcane\",\n \"Befuddled\",\n \"Bewildered\",\n \"Blursed\",\n \"Bogus\",\n \"Caffeinated\",\n \"Chaotic\",\n \"Chunky\",\n \"Cracked\",\n \"Crunchy\",\n \"Cryptic\",\n \"Cursed\",\n \"Damp\",\n \"Deranged\",\n \"Disheveled\",\n \"Doomed\",\n \"Elusive\",\n \"Ethereal\",\n \"Feral\",\n \"Flummoxed\",\n \"Flustered\",\n \"Forbidden\",\n \"Frantic\",\n \"Furious\",\n \"Glitchy\",\n \"Gobsmacked\",\n \"Goofy\",\n \"Grumpy\",\n \"Hapless\",\n \"Haunted\",\n \"Hollering\",\n \"Invisible\",\n \"Irate\",\n \"Janky\",\n \"Jittery\",\n \"Klutzy\",\n \"Lanky\",\n \"Listless\",\n \"Luminous\",\n \"Lurking\",\n \"Majestic\",\n \"Maniacal\",\n \"Manic\",\n \"Mystical\",\n \"Nefarious\",\n \"Nervy\",\n \"Notorious\",\n \"Oblivious\",\n \"Ominous\",\n \"Ornery\",\n \"Panicked\",\n \"Peculiar\",\n \"Phantom\",\n \"Plucky\",\n \"Prickly\",\n \"Querulous\",\n \"Rabid\",\n \"Rambling\",\n \"Reckless\",\n \"Restless\",\n \"Rogue\",\n \"Scruffy\",\n \"Smol\",\n \"Sneaky\",\n \"Snarky\",\n \"Soggy\",\n \"Spicy\",\n \"Spooky\",\n \"Suspicious\",\n \"Tangled\",\n \"Thunderous\",\n \"Turbulent\",\n \"Uncanny\",\n \"Unhinged\",\n \"Vexed\",\n \"Volatile\",\n \"Wacky\",\n \"Wobbly\",\n \"Zealous\",\n];\n","export const nouns: string[] = [\n // creatures & cryptids\n \"Armadillo\",\n \"Axolotl\",\n \"Banshee\",\n \"Basilisk\",\n \"Blobfish\",\n \"Boggart\",\n \"Capybara\",\n \"Chimera\",\n \"Coyote\",\n \"Cryptid\",\n \"Ferret\",\n \"Fetch\",\n \"Flamingo\",\n \"Gargoyle\",\n \"Gecko\",\n \"Goblin\",\n \"Gremlin\",\n \"Hedgehog\",\n \"Imp\",\n \"Jackalope\",\n \"Kelpie\",\n \"Kraken\",\n \"Lemur\",\n \"Mantis\",\n \"Mongoose\",\n \"Mothman\",\n \"Narwhal\",\n \"Okapi\",\n \"Opossum\",\n \"Pangolin\",\n \"Penguin\",\n \"Platypus\",\n \"Poltergeist\",\n \"Porcupine\",\n \"Quokka\",\n \"Raccoon\",\n \"Revenant\",\n \"Salamander\",\n \"Specter\",\n \"Tapir\",\n \"Tardigrade\",\n \"Thunderbird\",\n \"Toad\",\n \"Vulture\",\n \"Walrus\",\n \"Wendigo\",\n \"Wombat\",\n \"Wraith\",\n \"Wyrm\",\n \"Yak\",\n // objects, food & archetypes\n \"Anomaly\",\n \"Artifact\",\n \"Bandit\",\n \"Bauble\",\n \"Biscuit\",\n \"Blender\",\n \"Burrito\",\n \"Carbuncle\",\n \"Cassette\",\n \"Cauldron\",\n \"Chalice\",\n \"Cipher\",\n \"Cloak\",\n \"Contraption\",\n \"Doohickey\",\n \"Dumpling\",\n \"Enigma\",\n \"Fiasco\",\n \"Gizmo\",\n \"Grimoire\",\n \"Harbinger\",\n \"Lantern\",\n \"Maverick\",\n \"Menace\",\n \"Monocle\",\n \"Muffin\",\n \"Noodle\",\n \"Paradox\",\n \"Parchment\",\n \"Pickle\",\n \"Pretzel\",\n \"Relic\",\n \"Rogue\",\n \"Ruckus\",\n \"Scroll\",\n \"Sigil\",\n \"Spatula\",\n \"Talisman\",\n \"Thingamajig\",\n \"Toaster\",\n \"Vagrant\",\n \"Waffle\",\n \"Warlock\",\n \"Widget\",\n \"Wizard\",\n];\n","export const tech: string[] = [\n \"Axiom\",\n \"Axton\",\n \"Byton\",\n \"Cipher\",\n \"Cyron\",\n \"Daxon\",\n \"Dexon\",\n \"Draxon\",\n \"Exon\",\n \"Hexar\",\n \"Hexon\",\n \"Helix\",\n \"Ionex\",\n \"Kryox\",\n \"Kronos\",\n \"Kronox\",\n \"Lyron\",\n \"Matrix\",\n \"Naxon\",\n \"Neoron\",\n \"Nexar\",\n \"Nexon\",\n \"Nexus\",\n \"Omicron\",\n \"Phazon\",\n \"Photex\",\n \"Photon\",\n \"Praxon\",\n \"Proton\",\n \"Pulsar\",\n \"Quantum\",\n \"Quasar\",\n \"Synthex\",\n \"Synthos\",\n \"Tachyon\",\n \"Vector\",\n \"Vertex\",\n \"Vexar\",\n \"Vexon\",\n \"Vorex\",\n \"Vorton\",\n \"Vortex\",\n \"Xaeon\",\n \"Xyron\",\n \"Zenon\",\n \"Zephon\",\n \"Zeron\",\n \"Zython\",\n];\n","export const verbs: string[] = [\n \"Banishing\",\n \"Bumbling\",\n \"Careening\",\n \"Conjuring\",\n \"Devouring\",\n \"Enchanting\",\n \"Fleeing\",\n \"Fumbling\",\n \"Glitching\",\n \"Haunting\",\n \"Howling\",\n \"Jinxing\",\n \"Lumbering\",\n \"Lurking\",\n \"Menacing\",\n \"Napping\",\n \"Obliterating\",\n \"Pillaging\",\n \"Questing\",\n \"Rambling\",\n \"Rampaging\",\n \"Scheming\",\n \"Shambling\",\n \"Stampeding\",\n \"Stumbling\",\n \"Tinkering\",\n \"Unleashing\",\n \"Vanishing\",\n \"Wobbling\",\n \"Yelling\",\n];\n","import type { Casing } from \"./types.ts\";\n\nfunction titleCase(word: string): string {\n return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();\n}\n\nexport function applyFormat(\n words: string[],\n casing: Casing,\n separator: string,\n suffix: string,\n): string {\n let result: string;\n\n switch (casing) {\n case \"lowercase\":\n result = words.map((w) => w.toLowerCase()).join(separator);\n break;\n case \"uppercase\":\n result = words.map((w) => w.toUpperCase()).join(separator);\n break;\n case \"title\":\n result = words.map(titleCase).join(separator);\n break;\n case \"pascal\":\n result = words.map(titleCase).join(\"\");\n break;\n case \"camel\": {\n const [first, ...rest] = words.map(titleCase);\n result = (first ?? \"\").toLowerCase() + rest.join(\"\");\n break;\n }\n }\n\n return result + suffix;\n}\n","import { adjectives } from \"./words/adjectives.ts\";\nimport { nouns } from \"./words/nouns.ts\";\nimport { tech } from \"./words/tech.ts\";\nimport { verbs } from \"./words/verbs.ts\";\nimport { applyFormat } from \"./format.ts\";\nimport type { GenerateOptions, Style } from \"./types.ts\";\n\nfunction pickUnique(arr: string[], n: number): string[] {\n const copy = [...arr];\n for (let i = 0; i < n; i++) {\n const j = i + Math.floor(Math.random() * (copy.length - i));\n [copy[i], copy[j]] = [copy[j]!, copy[i]!];\n }\n return copy.slice(0, n);\n}\n\nfunction buildWords(style: Style): string[] {\n switch (style) {\n case \"adj-noun\":\n return [pickUnique(adjectives, 1)[0]!, pickUnique(nouns, 1)[0]!];\n case \"adj-adj-noun\": {\n const [adj1, adj2] = pickUnique(adjectives, 2);\n return [adj1!, adj2!, pickUnique(nouns, 1)[0]!];\n }\n case \"verb-noun\":\n return [pickUnique(verbs, 1)[0]!, pickUnique(nouns, 1)[0]!];\n case \"noun-noun\":\n return pickUnique(nouns, 2);\n case \"adj-tech\":\n return [pickUnique(adjectives, 1)[0]!, pickUnique(tech, 1)[0]!];\n case \"tech\":\n return [pickUnique(tech, 1)[0]!];\n }\n}\n\nfunction buildSuffix(digits: number | undefined): string {\n if (!digits) return \"\";\n let s = \"\";\n for (let i = 0; i < digits; i++) {\n s += Math.floor(Math.random() * 10).toString();\n }\n return s;\n}\n\nexport function generateName(options: GenerateOptions = {}): string {\n const {\n style = \"adj-noun\",\n separator = \"-\",\n casing = \"lowercase\",\n suffix,\n } = options;\n\n const words = buildWords(style);\n const suffixStr = buildSuffix(suffix);\n return applyFormat(words, casing, separator, suffixStr);\n}\n"],"mappings":";;AAAA,MAAa,aAAuB;CAClC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;ACjFA,MAAa,QAAkB;CAE7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;AClGA,MAAa,OAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;ACjDA,MAAa,QAAkB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;AC7BA,SAAS,UAAU,MAAsB;CACvC,OAAO,KAAK,OAAO,CAAC,EAAE,YAAY,IAAI,KAAK,MAAM,CAAC,EAAE,YAAY;AAClE;AAEA,SAAgB,YACd,OACA,QACA,WACA,QACQ;CACR,IAAI;CAEJ,QAAQ,QAAR;EACE,KAAK;GACH,SAAS,MAAM,KAAK,MAAM,EAAE,YAAY,CAAC,EAAE,KAAK,SAAS;GACzD;EACF,KAAK;GACH,SAAS,MAAM,KAAK,MAAM,EAAE,YAAY,CAAC,EAAE,KAAK,SAAS;GACzD;EACF,KAAK;GACH,SAAS,MAAM,IAAI,SAAS,EAAE,KAAK,SAAS;GAC5C;EACF,KAAK;GACH,SAAS,MAAM,IAAI,SAAS,EAAE,KAAK,EAAE;GACrC;EACF,KAAK,SAAS;GACZ,MAAM,CAAC,OAAO,GAAG,QAAQ,MAAM,IAAI,SAAS;GAC5C,UAAU,SAAS,IAAI,YAAY,IAAI,KAAK,KAAK,EAAE;GACnD;EACF;CACF;CAEA,OAAO,SAAS;AAClB;;;AC5BA,SAAS,WAAW,KAAe,GAAqB;CACtD,MAAM,OAAO,CAAC,GAAG,GAAG;CACpB,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KAAK;EAC1B,MAAM,IAAI,IAAI,KAAK,MAAM,KAAK,OAAO,KAAK,KAAK,SAAS,EAAE;EAC1D,CAAC,KAAK,IAAI,KAAK,MAAM,CAAC,KAAK,IAAK,KAAK,EAAG;CAC1C;CACA,OAAO,KAAK,MAAM,GAAG,CAAC;AACxB;AAEA,SAAS,WAAW,OAAwB;CAC1C,QAAQ,OAAR;EACE,KAAK,YACH,OAAO,CAAC,WAAW,YAAY,CAAC,EAAE,IAAK,WAAW,OAAO,CAAC,EAAE,EAAG;EACjE,KAAK,gBAAgB;GACnB,MAAM,CAAC,MAAM,QAAQ,WAAW,YAAY,CAAC;GAC7C,OAAO;IAAC;IAAO;IAAO,WAAW,OAAO,CAAC,EAAE;GAAG;EAChD;EACA,KAAK,aACH,OAAO,CAAC,WAAW,OAAO,CAAC,EAAE,IAAK,WAAW,OAAO,CAAC,EAAE,EAAG;EAC5D,KAAK,aACH,OAAO,WAAW,OAAO,CAAC;EAC5B,KAAK,YACH,OAAO,CAAC,WAAW,YAAY,CAAC,EAAE,IAAK,WAAW,MAAM,CAAC,EAAE,EAAG;EAChE,KAAK,QACH,OAAO,CAAC,WAAW,MAAM,CAAC,EAAE,EAAG;CACnC;AACF;AAEA,SAAS,YAAY,QAAoC;CACvD,IAAI,CAAC,QAAQ,OAAO;CACpB,IAAI,IAAI;CACR,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,KAC1B,KAAK,KAAK,MAAM,KAAK,OAAO,IAAI,EAAE,EAAE,SAAS;CAE/C,OAAO;AACT;AAEA,SAAgB,aAAa,UAA2B,CAAC,GAAW;CAClE,MAAM,EACJ,QAAQ,YACR,YAAY,KACZ,SAAS,aACT,WACE;CAIJ,OAAO,YAFO,WAAW,KAEF,GAAG,QAAQ,WADhB,YAAY,MACuB,CAAC;AACxD"}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
type Style = "adj-noun" | "adj-adj-noun" | "verb-noun" | "noun-noun" | "adj-tech" | "tech";
|
|
3
|
+
type Casing = "lowercase" | "uppercase" | "camel" | "pascal" | "title";
|
|
4
|
+
interface GenerateOptions {
|
|
5
|
+
/** Word pattern to use. Default: "adj-noun" */
|
|
6
|
+
style?: Style;
|
|
7
|
+
/** String placed between words. Default: "-" */
|
|
8
|
+
separator?: string;
|
|
9
|
+
/** Casing applied to the result. Default: "lowercase" */
|
|
10
|
+
casing?: Casing;
|
|
11
|
+
/** Append N random digits for extra uniqueness. */
|
|
12
|
+
suffix?: number;
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/generate.d.ts
|
|
16
|
+
declare function generateName(options?: GenerateOptions): string;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { type Casing, type GenerateOptions, type Style, generateName };
|
|
19
|
+
//# sourceMappingURL=index-D7MibTTX.d.cts.map
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
type Style = "adj-noun" | "adj-adj-noun" | "verb-noun" | "noun-noun" | "adj-tech" | "tech";
|
|
3
|
+
type Casing = "lowercase" | "uppercase" | "camel" | "pascal" | "title";
|
|
4
|
+
interface GenerateOptions {
|
|
5
|
+
/** Word pattern to use. Default: "adj-noun" */
|
|
6
|
+
style?: Style;
|
|
7
|
+
/** String placed between words. Default: "-" */
|
|
8
|
+
separator?: string;
|
|
9
|
+
/** Casing applied to the result. Default: "lowercase" */
|
|
10
|
+
casing?: Casing;
|
|
11
|
+
/** Append N random digits for extra uniqueness. */
|
|
12
|
+
suffix?: number;
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/generate.d.ts
|
|
16
|
+
declare function generateName(options?: GenerateOptions): string;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { type Casing, type GenerateOptions, type Style, generateName };
|
|
19
|
+
//# sourceMappingURL=index-D7MibTTX.d.ts.map
|