fix code to help CodeQL scanner

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2022-05-04 08:47:20 -04:00
1 parent cedde7f85a
commit a083afd83b
1 file changed
+3 -3
+3 -3
View File
@@ -29,14 +29,14 @@ const trailingDotDot = /\.\.$/;
* - Allow `...foo` as well as `..foo` * - Allow `...foo` as well as `..foo`
*/ */
export function convertKubectlJsonPathToNodeJsonPath(jsonPath: string) { export function convertKubectlJsonPathToNodeJsonPath(jsonPath: string) {
const startMatch = kubectlOptionPrefix.match(jsonPath); const captures = kubectlOptionPrefix.captures(jsonPath);
let start = "$"; let start = "$";
if (!startMatch.groups) { if (!captures) {
return start; return start;
} }
let { pathExpression } = startMatch.groups; let { pathExpression } = captures;
if (pathExpression.match(slashDashSearch)) { if (pathExpression.match(slashDashSearch)) {
const [first, ...rest] = pathExpression.split(pathByBareDots); const [first, ...rest] = pathExpression.split(pathByBareDots);