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

Function OptionFromNullishOr

packages/effect/src/Schema.ts:7276–7291  ·  view source on GitHub ↗
(
  value: Value,
  onNoneEncoding: null | undefined
)

Source from the content-addressed store, hash-verified

7274 * @since 3.10.0
7275 */
7276export function OptionFromNullishOr<Value extends Schema.Any>(
7277 value: Value,
7278 onNoneEncoding: null | undefined
7279): OptionFromNullishOr<Value> {
7280 return transform(
7281 NullishOr(value),
7282 OptionFromSelf(typeSchema(asSchema(value))),
7283 {
7284 strict: true,
7285 decode: (i) => option_.fromNullable(i),
7286 encode: onNoneEncoding === null ?
7287 (a) => option_.getOrNull(a) :
7288 (a) => option_.getOrUndefined(a)
7289 }
7290 )
7291}
7292
7293/**
7294 * @category api interface

Callers

nothing calls this directly

Calls 5

typeSchemaFunction · 0.85
asSchemaFunction · 0.85
transformInterface · 0.70
NullishOrFunction · 0.70
OptionFromSelfFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…