MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / measureResultChars

Function measureResultChars

packages/core/execution/src/engine.ts:72–81  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

70 * `JSON.stringify` rejects, e.g. a BigInt) — unknown size, not zero.
71 */
72const measureResultChars = (value: unknown): number => {
73 if (value == null) return 0;
74 if (typeof value === "string") return value.length;
75 // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: best-effort size probe over an arbitrary sandbox value; a stringify rejection must not fail the execution path
76 try {
77 return JSON.stringify(value)?.length ?? 0;
78 } catch {
79 return -1;
80 }
81};
82
83/**
84 * Outcome attributes are a pure function of an immutable `ExecuteResult`, but

Callers 1

executeOutcomeAttributesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected