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

Function measureResultChars

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

Source from the content-addressed store, hash-verified

80 * `JSON.stringify` rejects, e.g. a BigInt) — unknown size, not zero.
81 */
82const measureResultChars = (value: unknown): number => {
83 if (value == null) return 0;
84 if (typeof value === "string") return value.length;
85 // 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
86 try {
87 return JSON.stringify(value)?.length ?? 0;
88 } catch {
89 return -1;
90 }
91};
92
93/**
94 * 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