MCPcopy Create free account
hub / github.com/wevm/viem / toIdentifier

Function toIdentifier

scripts/generateTokenlist.ts:421–428  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

419}
420
421function toIdentifier(value: string) {
422 const identifier = value.replace(/[^a-zA-Z0-9]+/g, '').toLowerCase()
423
424 if (!identifier)
425 throw new Error(`Could not derive token import name from "${value}".`)
426 if (/^\d/.test(identifier)) return `token${identifier}`
427 return identifier
428}
429
430function assertTokenlist(
431 value: unknown,

Callers 1

getUniqueImportNameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected