MCPcopy Create free account
hub / github.com/ScattrdBlade/bigFileUpload / getNestedValue

Function getNestedValue

utils/sharex.ts:21–35  ·  view source on GitHub ↗
(data: unknown, path: string)

Source from the content-addressed store, hash-verified

19}
20
21function getNestedValue(data: unknown, path: string): unknown {
22 const normalizedPath = path.replace(/\[(\d+)\]/g, ".$1");
23 const segments = normalizedPath.split(".").filter(Boolean);
24
25 let current: unknown = data;
26 for (const segment of segments) {
27 if (!current || typeof current !== "object" || !(segment in current)) {
28 return undefined;
29 }
30
31 current = (current as Record<string, unknown>)[segment];
32 }
33
34 return current;
35}
36
37export function parseShareXConfig(configText: string): ShareXUploaderConfig {
38 let parsed: unknown;

Callers 1

resolveShareXTemplateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected