1/** 2 * Un-escape a string that has been escaped with {@link escape}. 3 * 4 * If the {@link windowsPathsNoEscape} option is used, then square-brace 5 * escapes are removed, but not backslash escapes. For example, it will turn 6 * the string `'[*]'` into `*`, but it will not turn `'\\*'` into `'*'`, 7 * becuase `\` is a path separator in `windowsPathsNoEscape` mode. 8 * 9 * When `windowsPathsNoEscape` is not set, then both brace escapes and 10 * backslash escapes are removed. 11 * 12 * Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped 13 * or unescaped. 14 */ 15export const unescape = (s, { windowsPathsNoEscape = false, } = {}) => { 16 return windowsPathsNoEscape 17 ? s.replace(/\[([^\/\\])\]/g, '$1') 18 : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, '$1$2').replace(/\\([^\/])/g, '$1'); 19}; 20//# sourceMappingURL=unescape.js.map