MCPcopy Index your code
hub / github.com/Effect-TS/effect / getLefts

Function getLefts

packages/effect/src/Record.ts:735–747  ·  view source on GitHub ↗
(
  self: ReadonlyRecord<K, Either<R, L>>
)

Source from the content-addressed store, hash-verified

733 * @since 2.0.0
734 */
735export const getLefts = <K extends string, R, L>(
736 self: ReadonlyRecord<K, Either<R, L>>
737): Record<ReadonlyRecord.NonLiteralKey<K>, L> => {
738 const out: Record<string, L> = empty()
739 for (const key of keys(self)) {
740 const value = self[key]
741 if (E.isLeft(value)) {
742 out[key] = value.left
743 }
744 }
745
746 return out
747}
748
749/**
750 * Given a record with `Either` values, returns a new record containing only the `Right` values, preserving the original keys.

Callers

nothing calls this directly

Calls 2

emptyFunction · 0.70
keysFunction · 0.70

Tested by

no test coverage detected