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

Function pruneAnnotations

packages/effect/src/SchemaRepresentation.ts:836–846  ·  view source on GitHub ↗
(
  annotations: Readonly<Record<string, unknown>>
)

Source from the content-addressed store, hash-verified

834const JsonAnnotationsSchema = Schema.Record(Schema.String, Schema.Json)
835
836function pruneAnnotations(
837 annotations: Readonly<Record<string, unknown>>
838): Option.Option<Readonly<Record<string, Schema.Json>>> {
839 const out: Record<string, Schema.Json> = {}
840 for (const [key, value] of Object.entries(annotations)) {
841 if (SchemaAST.isJson(value)) {
842 InternalRecord.assignProperty(out, key, value)
843 }
844 }
845 return Object.keys(out).length === 0 ? Option.none() : Option.some(out)
846}
847
848const AnnotationsSchema = Schema.optional(LiveAnnotationsSchema).pipe(
849 Schema.encodeTo(Schema.optionalKey(JsonAnnotationsSchema), {

Callers 1

Calls 1

someMethod · 0.80

Tested by

no test coverage detected