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

Function camelize

packages/tools/openapi-generator/src/Utils.ts:25–46  ·  view source on GitHub ↗
(self: string)

Source from the content-addressed store, hash-verified

23 * @since 4.0.0
24 */
25export const camelize = (self: string): string => {
26 let str = ""
27 let hadSymbol = false
28 for (let i = 0; i < self.length; i++) {
29 const charCode = self.charCodeAt(i)
30 if (
31 (charCode >= 65 && charCode <= 90) ||
32 (charCode >= 97 && charCode <= 122)
33 ) {
34 str += hadSymbol ? self[i].toUpperCase() : self[i]
35 hadSymbol = false
36 } else if (charCode >= 48 && charCode <= 57) {
37 if (str.length > 0) {
38 str += self[i]
39 hadSymbol = true
40 }
41 } else if (str.length > 0) {
42 hadSymbol = true
43 }
44 }
45 return str
46}
47
48/**
49 * Converts an OpenAPI operation id into the exported operation identifier used

Callers 1

identifierFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected