MCPcopy Create free account
hub / github.com/arctic-cli/interface / generateID

Function generateID

packages/arctic/src/id/id.ts:32–41  ·  view source on GitHub ↗
(prefix: keyof typeof prefixes, descending: boolean, given?: string)

Source from the content-addressed store, hash-verified

30 }
31
32 function generateID(prefix: keyof typeof prefixes, descending: boolean, given?: string): string {
33 if (!given) {
34 return create(prefix, descending)
35 }
36
37 if (!given.startsWith(prefixes[prefix])) {
38 throw new Error(`ID ${given} does not start with ${prefixes[prefix]}`)
39 }
40 return given
41 }
42
43 function randomBase62(length: number): string {
44 const chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"

Callers 2

ascendingFunction · 0.85
descendingFunction · 0.85

Calls 1

createFunction · 0.70

Tested by

no test coverage detected