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

Function value

packages/effect/src/unstable/reactivity/AsyncResult.ts:416–423  ·  view source on GitHub ↗
(self: AsyncResult<A, E>)

Source from the content-addressed store, hash-verified

414 * @since 4.0.0
415 */
416export const value = <A, E>(self: AsyncResult<A, E>): Option.Option<A> => {
417 if (self._tag === "Success") {
418 return Option.some(self.value)
419 } else if (self._tag === "Failure") {
420 return Option.map(self.previousSuccess, (s) => s.value)
421 }
422 return Option.none()
423}
424
425/**
426 * Returns the available value from `value`, or evaluates the fallback when no current or previous success exists.

Callers 3

AsyncResult.tsFile · 0.70
getOrThrowFunction · 0.70
SchemaFunction · 0.70

Calls 2

someMethod · 0.80
mapMethod · 0.45

Tested by

no test coverage detected