Skip to content

Commit cc4b331

Browse files
authored
Merge pull request microsoft#9716 from Microsoft/moveEndsWIth
move endsWith to core.ts
2 parents d7e17aa + 4f9a234 commit cc4b331

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/compiler/core.ts

+11
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,17 @@ namespace ts {
899899
return true;
900900
}
901901

902+
/* @internal */
903+
export function startsWith(str: string, prefix: string): boolean {
904+
return str.lastIndexOf(prefix, 0) === 0;
905+
}
906+
907+
/* @internal */
908+
export function endsWith(str: string, suffix: string): boolean {
909+
const expectedPos = str.length - suffix.length;
910+
return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;
911+
}
912+
902913
export function fileExtensionIs(path: string, extension: string): boolean {
903914
return path.length > extension.length && endsWith(path, extension);
904915
}

src/compiler/utilities.ts

-9
Original file line numberDiff line numberDiff line change
@@ -3113,13 +3113,4 @@ namespace ts {
31133113
export function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean {
31143114
return node.flags & NodeFlags.ParameterPropertyModifier && node.parent.kind === SyntaxKind.Constructor && isClassLike(node.parent.parent);
31153115
}
3116-
3117-
export function startsWith(str: string, prefix: string): boolean {
3118-
return str.lastIndexOf(prefix, 0) === 0;
3119-
}
3120-
3121-
export function endsWith(str: string, suffix: string): boolean {
3122-
const expectedPos = str.length - suffix.length;
3123-
return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;
3124-
}
31253116
}

0 commit comments

Comments
 (0)