| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 | /*---------------------------------------------------------------------------------------------*  Copyright (c) Microsoft Corporation. All rights reserved.*  Licensed under the MIT License. See License.txt in the project root for license information.*--------------------------------------------------------------------------------------------*/export function startsWith(haystack, needle) {    if (haystack.length < needle.length) {        return false;    }    for (var i = 0; i < needle.length; i++) {        if (haystack[i] !== needle[i]) {            return false;        }    }    return true;}/** * Determines if haystack ends with needle. */export function endsWith(haystack, needle) {    var diff = haystack.length - needle.length;    if (diff > 0) {        return haystack.lastIndexOf(needle) === diff;    }    else if (diff === 0) {        return haystack === needle;    }    else {        return false;    }}export function convertSimple2RegExpPattern(pattern) {    return pattern.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, '\\$&').replace(/[\*]/g, '.*');}export function repeat(value, count) {    var s = '';    while (count > 0) {        if ((count & 1) === 1) {            s += value;        }        value += value;        count = count >>> 1;    }    return s;}export function extendedRegExp(pattern) {    if (startsWith(pattern, '(?i)')) {        return new RegExp(pattern.substring(4), 'i');    }    else {        return new RegExp(pattern);    }}
 |