Skip to content

Commit c77fcf2

Browse files
Merge pull request #28932 from j-oliveras/No-es2015-usages
Change es2015 usages to existing ts functions
2 parents bc59582 + 599a963 commit c77fcf2

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/compiler/inspectValue.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ namespace ts {
148148
}
149149

150150
export function isJsPrivate(name: string): boolean {
151-
return name.startsWith("_");
151+
return startsWith(name, "_");
152152
}
153153

154154
function tryRequire(fileNameToRequire: string): unknown {

src/compiler/moduleSpecifiers.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ namespace ts.moduleSpecifiers {
203203
return; // Don't want to a package to globally import from itself
204204
}
205205

206-
const target = targets.find(t => compareStrings(t.slice(0, resolved.length + 1), resolved + "/") === Comparison.EqualTo);
206+
const target = find(targets, t => compareStrings(t.slice(0, resolved.length + 1), resolved + "/") === Comparison.EqualTo);
207207
if (target === undefined) return;
208208

209209
const relative = getRelativePathFromDirectory(resolved, target, getCanonicalFileName);

src/services/rename.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +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");
48+
const withoutIndex = endsWith(node.text, "/index") || endsWith(node.text, "/index.js") ? undefined : tryRemoveSuffix(removeFileExtension(moduleSourceFile.fileName), "/index");
4949
const name = withoutIndex === undefined ? moduleSourceFile.fileName : withoutIndex;
5050
const kind = withoutIndex === undefined ? ScriptElementKind.moduleElement : ScriptElementKind.directory;
5151
const indexAfterLastSlash = node.text.lastIndexOf("/") + 1;

0 commit comments

Comments
 (0)