| 23 | * @since 4.0.0 |
| 24 | */ |
| 25 | export 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 |