(input)
| 93 | }; |
| 94 | |
| 95 | function camelCase(input) { |
| 96 | let result = input.trim(); |
| 97 | |
| 98 | if (result.length === 0) { |
| 99 | return ""; |
| 100 | } |
| 101 | |
| 102 | if (result.length === 1) { |
| 103 | return result.toLowerCase(); |
| 104 | } |
| 105 | |
| 106 | const hasUpperCase = result !== result.toLowerCase(); |
| 107 | |
| 108 | if (hasUpperCase) { |
| 109 | result = preserveCamelCase(result); |
| 110 | } |
| 111 | |
| 112 | return result |
| 113 | .replace(/^[_.\- ]+/, "") |
| 114 | .toLowerCase() |
| 115 | .replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu, (_, p1) => p1.toUpperCase()) |
| 116 | .replace(/\d+([\p{Alpha}\p{N}_]|$)/gu, (m) => m.toUpperCase()); |
| 117 | } |
| 118 | |
| 119 | function escape(string) { |
| 120 | let output = ""; |
no test coverage detected