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

Function optionFromOptional

packages/effect/src/SchemaTransformation.ts:1370–1375  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1368 * @since 4.0.0
1369 */
1370export function optionFromOptional<T>(): Transformation<Option.Option<T>, T | undefined> {
1371 return transformOptional<Option.Option<T>, T | undefined>({
1372 decode: (ot) => ot.pipe(Option.filter(Predicate.isNotUndefined), Option.some),
1373 encode: Option.flatten
1374 })
1375}
1376
1377/**
1378 * Decodes a `string` into a `URL` and encodes a `URL` back to its `href`

Callers

nothing calls this directly

Calls 3

filterMethod · 0.80
transformOptionalFunction · 0.70
pipeMethod · 0.65

Tested by

no test coverage detected