add remove calc

This commit is contained in:
Yuki Ueda
2016-04-20 14:33:56 +09:00
parent f9562a5cbf
commit 466f11d631

View File

@@ -24,7 +24,7 @@ export function startsWith(haystack: string, needle: string): boolean {
export function endsWith(haystack: string, needle: string): boolean {
let diff = haystack.length - needle.length;
if (diff > 0) {
return haystack.lastIndexOf(needle) === haystack.length - needle.length;
return haystack.lastIndexOf(needle) === diff;
} else if (diff === 0) {
return haystack === needle;
} else {
@@ -34,4 +34,4 @@ export function endsWith(haystack: string, needle: string): boolean {
export function convertSimple2RegExpPattern(pattern: string): string {
return pattern.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, '\\$&').replace(/[\*]/g, '.*');
}
}