1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Fix type error after rebase

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-04-26 09:22:15 -04:00
parent 35903c05a0
commit cdfb0deb14

View File

@ -4,12 +4,13 @@
*/ */
import { JSONPath } from "@astronautlabs/jsonpath"; import { JSONPath } from "@astronautlabs/jsonpath";
import { TypedRegEx } from "typed-regex";
const slashDashSearch = /[\\-]/g; const slashDashSearch = /[\\-]/g;
const pathByBareDots = /(?<=\w)\./; const pathByBareDots = /(?<=\w)\./;
const textBeforeFirstSquare = /^.*(?=\[)/g; const textBeforeFirstSquare = /^.*(?=\[)/g;
const backSlash = /\\/g; const backSlash = /\\/g;
const kubectlOptionPrefix = /^\$?\.?(?<pathExpression>.*)/; const kubectlOptionPrefix = TypedRegEx("^\\$?\\.?(?<pathExpression>.*)");
const sliceVersion = /\[]/g; const sliceVersion = /\[]/g;
const tripleDotName = /\.\.\.(?<trailing>.)/g; const tripleDotName = /\.\.\.(?<trailing>.)/g;
const trailingDotDot = /\.\.$/; const trailingDotDot = /\.\.$/;
@ -28,10 +29,10 @@ 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 = jsonPath.match(kubectlOptionPrefix); const startMatch = kubectlOptionPrefix.match(jsonPath);
let start = "$"; let start = "$";
if (!startMatch) { if (!startMatch.groups) {
return start; return start;
} }