2 /*---------------------------------------------------------------------------------------------
\r
3 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
4 * Licensed under the MIT License. See License.txt in the project root for license information.
\r
5 *--------------------------------------------------------------------------------------------*/
\r
6 Object.defineProperty(exports, "__esModule", { value: true });
\r
7 exports.convertSimple2RegExpPattern = exports.endsWith = void 0;
\r
9 * Determines if haystack ends with needle.
\r
11 function endsWith(haystack, needle) {
\r
12 let diff = haystack.length - needle.length;
\r
14 return haystack.lastIndexOf(needle) === diff;
\r
16 else if (diff === 0) {
\r
17 return haystack === needle;
\r
23 exports.endsWith = endsWith;
\r
24 function convertSimple2RegExpPattern(pattern) {
\r
25 return pattern.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, '\\$&').replace(/[\*]/g, '.*');
\r
27 exports.convertSimple2RegExpPattern = convertSimple2RegExpPattern;
\r
28 //# sourceMappingURL=strings.js.map