massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / table / node_modules / ajv / dist / runtime / parseJson.js
index 2576a6e1775c793d7cb1184fe07d26b298a6e821..7ebbc1bfcc59f2d8633e93947215a49567d1610e 100644 (file)
@@ -130,17 +130,18 @@ function parseJsonString(s, pos) {
                 let code = 0;
                 while (count--) {
                     code <<= 4;
-                    c = s[pos].toLowerCase();
+                    c = s[pos];
+                    if (c === undefined) {
+                        errorMessage("unexpected end");
+                        return undefined;
+                    }
+                    c = c.toLowerCase();
                     if (c >= "a" && c <= "f") {
                         code += c.charCodeAt(0) - CODE_A + 10;
                     }
                     else if (c >= "0" && c <= "9") {
                         code += c.charCodeAt(0) - CODE_0;
                     }
-                    else if (c === undefined) {
-                        errorMessage("unexpected end");
-                        return undefined;
-                    }
                     else {
                         errorMessage(`unexpected token ${c}`);
                         return undefined;
@@ -153,6 +154,7 @@ function parseJsonString(s, pos) {
                 errorMessage(`unexpected token ${c}`);
                 return undefined;
             }
+            // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
         }
         else if (c === undefined) {
             errorMessage("unexpected end");