MCPcopy Create free account
hub / github.com/Effect-TS/effect / snakeToPascal

Function snakeToPascal

packages/effect/src/String.ts:1060–1067  ·  view source on GitHub ↗
(self: string)

Source from the content-addressed store, hash-verified

1058 * @since 2.0.0
1059 */
1060export const snakeToPascal = (self: string): string => {
1061 if (self.length === 0) return self
1062 let str = self[0].toUpperCase()
1063 for (let i = 1; i < self.length; i++) {
1064 str += self[i] === "_" ? self[++i].toUpperCase() : self[i]
1065 }
1066 return str
1067}
1068
1069/**
1070 * Converts a snake_case string to kebab-case.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected