MCPcopy
hub / github.com/Effect-TS/effect / applyDefaultValue

Function applyDefaultValue

packages/effect/src/Schema.ts:2041–2045  ·  view source on GitHub ↗
(o: option_.Option<A>, defaultValue: () => A)

Source from the content-addressed store, hash-verified

2039})
2040
2041const applyDefaultValue = <A>(o: option_.Option<A>, defaultValue: () => A) =>
2042 option_.match(o, {
2043 onNone: () => option_.some(defaultValue()),
2044 onSome: (value) => option_.some(value === undefined ? defaultValue() : value)
2045 })
2046
2047const pruneUndefined = (ast: AST.AST): AST.AST | undefined =>
2048 AST.pruneUndefined(ast, pruneUndefined, (ast) => {

Callers 1

Schema.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected