Skip to content

Commit f4175c0

Browse files
authored
Merge pull request #14076 from JamesHenry/make-unescapeIdentifier-public
Make unescapeIdentifier public
2 parents 87b780d + 2cd0385 commit f4175c0

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/compiler/utilities.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -398,11 +398,6 @@ namespace ts {
398398
return identifier.length >= 2 && identifier.charCodeAt(0) === CharacterCodes._ && identifier.charCodeAt(1) === CharacterCodes._ ? "_" + identifier : identifier;
399399
}
400400

401-
// Remove extra underscore from escaped identifier
402-
export function unescapeIdentifier(identifier: string): string {
403-
return identifier.length >= 3 && identifier.charCodeAt(0) === CharacterCodes._ && identifier.charCodeAt(1) === CharacterCodes._ && identifier.charCodeAt(2) === CharacterCodes._ ? identifier.substr(1) : identifier;
404-
}
405-
406401
// Make an identifier from an external module name by extracting the string after the last "/" and replacing
407402
// all non-alphanumeric characters with underscores
408403
export function makeIdentifierFromModuleName(moduleName: string): string {
@@ -4548,4 +4543,14 @@ namespace ts {
45484543

45494544
return undefined;
45504545
}
4546+
4547+
/**
4548+
* Remove extra underscore from escaped identifier text content.
4549+
*
4550+
* @param identifier The escaped identifier text.
4551+
* @returns The unescaped identifier text.
4552+
*/
4553+
export function unescapeIdentifier(identifier: string): string {
4554+
return identifier.length >= 3 && identifier.charCodeAt(0) === CharacterCodes._ && identifier.charCodeAt(1) === CharacterCodes._ && identifier.charCodeAt(2) === CharacterCodes._ ? identifier.substr(1) : identifier;
4555+
}
45514556
}

0 commit comments

Comments
 (0)