@import completion for css/scss/less. Fix #51331

This commit is contained in:
Pine Wu
2018-08-07 16:01:21 -07:00
parent 37199daa9f
commit a40bfc947c
8 changed files with 152 additions and 19 deletions

View File

@@ -17,3 +17,17 @@ export function startsWith(haystack: string, needle: string): boolean {
return true;
}
/**
* Determines if haystack ends with needle.
*/
export function endsWith(haystack: string, needle: string): boolean {
let diff = haystack.length - needle.length;
if (diff > 0) {
return haystack.lastIndexOf(needle) === diff;
} else if (diff === 0) {
return haystack === needle;
} else {
return false;
}
}