Skip to content

Commit 4e43dcd

Browse files
committed
Change usages of String.prototype.endsWith to ts.endsWith.
1 parent 3d23e7a commit 4e43dcd

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/services/rename.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ namespace ts.Rename {
4545

4646
const moduleSourceFile = find(moduleSymbol.declarations, isSourceFile);
4747
if (!moduleSourceFile) return undefined;
48-
const withoutIndex = node.text.endsWith("/index") || node.text.endsWith("/index.js") ? undefined : tryRemoveSuffix(removeFileExtension(moduleSourceFile.fileName), "/index");
49-
const name = withoutIndex === undefined ? moduleSourceFile.fileName : withoutIndex;
48+
const withoutIndex = endsWith(node.text, "/index") || endsWith(node.text, "/index.js") ? undefined : tryRemoveSuffix(removeFileExtension(moduleSourceFile.fileName), "/index"); const name = withoutIndex === undefined ? moduleSourceFile.fileName : withoutIndex;
5049
const kind = withoutIndex === undefined ? ScriptElementKind.moduleElement : ScriptElementKind.directory;
5150
const indexAfterLastSlash = node.text.lastIndexOf("/") + 1;
5251
// Span should only be the last component of the path. + 1 to account for the quote character.

0 commit comments

Comments
 (0)