From 4f9a23468b4abce5bb752c68ef8ead9c343104f1 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Wed, 13 Jul 2016 17:08:57 -0700 Subject: [PATCH] move endsWith to core.ts --- src/compiler/core.ts | 11 +++++++++++ src/compiler/utilities.ts | 9 --------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 7c125d72e99..5764c316090 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -899,6 +899,17 @@ namespace ts { return true; } + /* @internal */ + export function startsWith(str: string, prefix: string): boolean { + return str.lastIndexOf(prefix, 0) === 0; + } + + /* @internal */ + export function endsWith(str: string, suffix: string): boolean { + const expectedPos = str.length - suffix.length; + return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos; + } + export function fileExtensionIs(path: string, extension: string): boolean { return path.length > extension.length && endsWith(path, extension); } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index f970a94373a..7219a5bbd24 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -3113,13 +3113,4 @@ namespace ts { export function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean { return node.flags & NodeFlags.ParameterPropertyModifier && node.parent.kind === SyntaxKind.Constructor && isClassLike(node.parent.parent); } - - export function startsWith(str: string, prefix: string): boolean { - return str.lastIndexOf(prefix, 0) === 0; - } - - export function endsWith(str: string, suffix: string): boolean { - const expectedPos = str.length - suffix.length; - return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos; - } }