source: node_modules/minimatch/dist/commonjs/unescape.js

main
Last change on this file was 33517cc, checked in by Klimentina Efremova <klimentina08642@…>, 10 days ago

Turned database from SQLite to PostgressSQL, updated database changes from Phase 1 and 2

  • Property mode set to 100644
File size: 1.4 KB
Line 
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.unescape = void 0;
4/**
5 * Un-escape a string that has been escaped with {@link escape}.
6 *
7 * If the {@link MinimatchOptions.windowsPathsNoEscape} option is used, then
8 * square-bracket escapes are removed, but not backslash escapes.
9 *
10 * For example, it will turn the string `'[*]'` into `*`, but it will not
11 * turn `'\\*'` into `'*'`, because `\` is a path separator in
12 * `windowsPathsNoEscape` mode.
13 *
14 * When `windowsPathsNoEscape` is not set, then both square-bracket escapes and
15 * backslash escapes are removed.
16 *
17 * Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped
18 * or unescaped.
19 *
20 * When `magicalBraces` is not set, escapes of braces (`{` and `}`) will not be
21 * unescaped.
22 */
23const unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true, } = {}) => {
24 if (magicalBraces) {
25 return windowsPathsNoEscape ?
26 s.replace(/\[([^/\\])\]/g, '$1')
27 : s
28 .replace(/((?!\\).|^)\[([^/\\])\]/g, '$1$2')
29 .replace(/\\([^/])/g, '$1');
30 }
31 return windowsPathsNoEscape ?
32 s.replace(/\[([^/\\{}])\]/g, '$1')
33 : s
34 .replace(/((?!\\).|^)\[([^/\\{}])\]/g, '$1$2')
35 .replace(/\\([^/{}])/g, '$1');
36};
37exports.unescape = unescape;
38//# sourceMappingURL=unescape.js.map
Note: See TracBrowser for help on using the repository browser.