MCPcopy Create free account
hub / github.com/antfu/utils / ensurePrefix

Function ensurePrefix

src/string.ts:17–21  ·  view source on GitHub ↗
(prefix: string, str: string)

Source from the content-addressed store, hash-verified

15 * @category String
16 */
17export function ensurePrefix(prefix: string, str: string) {
18 if (!str.startsWith(prefix))
19 return prefix + str
20 return str
21}
22
23/**
24 * Ensure suffix of a string

Callers 1

string.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected