MCPcopy Create free account
hub / github.com/Effect-TS/effect / cap

Function cap

packages/effect/src/ui/MessageLog.ts:1558–1562  ·  view source on GitHub ↗
(encoded: Schema.Json)

Source from the content-addressed store, hash-verified

1556 value: unknown
1557 ): Schema.Json => cap(through(component, field, value) as Schema.Json)
1558 const cap = (encoded: Schema.Json): Schema.Json => {
1559 if (maxEntryBytes === Infinity) return encoded
1560 const bytes = utf8Length(JSON.stringify(encoded))
1561 return bytes > maxEntryBytes ? { "~truncated": bytes } : encoded
1562 }
1563 const props = (
1564 entry: { readonly component: Component.Mountable.Any; readonly props: unknown }
1565 ) => through(entry.component, "props", entry.props) as Schema.Json

Callers 5

encodeQueriesFunction · 0.85
encodeSharedFunction · 0.85
encodeCollectedFunction · 0.85
cappedFunction · 0.85
encodeFunction · 0.85

Calls 1

utf8LengthFunction · 0.70

Tested by

no test coverage detected