File size: 412 Bytes
f59fbe2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
export function buildCaseInsensitiveGlobLiteral(input: string) {
  let out = "";
  for (const ch of input) {
    if ((ch >= "a" && ch <= "z") || (ch >= "A" && ch <= "Z")) {
      const l = ch.toLowerCase();
      const u = ch.toUpperCase();
      out += `[${l}${u}]`;
    } else {
      if ("*?[]{}\\".includes(ch)) {
        out += "\\" + ch;
      } else {
        out += ch;
      }
    }
  }
  return out;
}