(moduleSpecifier, target, forceCapitalize)
| 153933 | } |
| 153934 | codefix.moduleSymbolToValidIdentifier = moduleSymbolToValidIdentifier; |
| 153935 | function moduleSpecifierToValidIdentifier(moduleSpecifier, target, forceCapitalize) { |
| 153936 | var baseName = ts.getBaseFileName(ts.removeSuffix(moduleSpecifier, "/index")); |
| 153937 | var res = ""; |
| 153938 | var lastCharWasValid = true; |
| 153939 | var firstCharCode = baseName.charCodeAt(0); |
| 153940 | if (ts.isIdentifierStart(firstCharCode, target)) { |
| 153941 | res += String.fromCharCode(firstCharCode); |
| 153942 | if (forceCapitalize) { |
| 153943 | res = res.toUpperCase(); |
| 153944 | } |
| 153945 | } |
| 153946 | else { |
| 153947 | lastCharWasValid = false; |
| 153948 | } |
| 153949 | for (var i = 1; i < baseName.length; i++) { |
| 153950 | var ch = baseName.charCodeAt(i); |
| 153951 | var isValid = ts.isIdentifierPart(ch, target); |
| 153952 | if (isValid) { |
| 153953 | var char = String.fromCharCode(ch); |
| 153954 | if (!lastCharWasValid) { |
| 153955 | char = char.toUpperCase(); |
| 153956 | } |
| 153957 | res += char; |
| 153958 | } |
| 153959 | lastCharWasValid = isValid; |
| 153960 | } |
| 153961 | // Need `|| "_"` to ensure result isn't empty. |
| 153962 | return !ts.isStringANonContextualKeyword(res) ? res || "_" : "_".concat(res); |
| 153963 | } |
| 153964 | codefix.moduleSpecifierToValidIdentifier = moduleSpecifierToValidIdentifier; |
| 153965 | })(codefix = ts.codefix || (ts.codefix = {})); |
| 153966 | })(ts || (ts = {})); |
no test coverage detected