MCPcopy Create free account
hub / github.com/callstack/agent-device / decodeReplayEnvValue

Function decodeReplayEnvValue

src/replay/script.ts:144–158  ·  view source on GitHub ↗
(raw: string, lineNumber: number)

Source from the content-addressed store, hash-verified

142}
143
144function decodeReplayEnvValue(raw: string, lineNumber: number): string {
145 if (raw.length === 0) return '';
146 if (raw.startsWith('"')) {
147 try {
148 const parsed = JSON.parse(raw) as unknown;
149 if (typeof parsed !== 'string') {
150 throw new Error('not a string literal');
151 }
152 return parsed;
153 } catch {
154 throw new AppError('INVALID_ARGS', `Invalid quoted env value on line ${lineNumber}.`);
155 }
156 }
157 return raw;
158}
159
160function ingestEnvLine(metadata: ReplayScriptMetadata, trimmed: string, lineNumber: number): void {
161 const { key, value } = parseReplayEnvLine(trimmed, lineNumber);

Callers 1

parseReplayEnvLineFunction · 0.85

Calls 2

startsWithMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…