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

Function measureResultChars

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

Source from the content-addressed store, hash-verified

72 * `JSON.stringify` rejects, e.g. a BigInt) — unknown size, not zero.
73 */
74const measureResultChars = (value: unknown): number => {
75 if (value == null) return 0;
76 if (typeof value === "string") return value.length;
77 // 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
78 try {
79 return JSON.stringify(value)?.length ?? 0;
80 } catch {
81 return -1;
82 }
83};
84
85/**
86 * 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