MCPcopy Create free account
hub / github.com/effect-app/libs / ReadonlyMap

Function ReadonlyMap

repos/effect/packages/effect/src/Schema.ts:9763–9819  ·  view source on GitHub ↗
(
  key: Key,
  value: Value
)

Source from the content-addressed store, hash-verified

9761): OptionFromNullishOr<S> {
9762 return NullishOr(schema).pipe(decodeTo(
9763 Option(toType(schema)),
9764 SchemaTransformation.optionFromNullishOr(options)
9765 ))
9766}
9767
9768/**
9769 * Type-level representation returned by {@link OptionFromOptionalKey}.
9770 *
9771 * @category models
9772 * @since 4.0.0
9773 */
9774export interface OptionFromOptionalKey<S extends Constraint> extends decodeTo<Option<toType<S>>, optionalKey<S>> {
9775 readonly "Rebuild": OptionFromOptionalKey<S>
9776}
9777
9778/**
9779 * Decodes an optional value `A` to a required `Option<A>` value.
9780 *
9781 * **Details**
9782 *
9783 * Decoding maps a missing key to `None` and a present value to `Some`.
9784 * Encoding maps `None` to a missing key and maps `Some` to its value.
9785 *
9786 * @category schemas
9787 * @since 4.0.0
9788 */
9789export function OptionFromOptionalKey<S extends Constraint>(schema: S): OptionFromOptionalKey<S> {
9790 return optionalKey(schema).pipe(decodeTo(
9791 Option(toType(schema)),
9792 SchemaTransformation.optionFromOptionalKey()
9793 ))
9794}
9795
9796/**
9797 * Type-level representation returned by {@link OptionFromOptional}.
9798 *
9799 * @category models
9800 * @since 4.0.0
9801 */
9802export interface OptionFromOptional<S extends Constraint> extends decodeTo<Option<toType<S>>, optional<S>> {
9803 readonly "Rebuild": OptionFromOptional<S>
9804}
9805
9806/**
9807 * Decodes an optional or `undefined` value `A` to a required `Option<A>`
9808 * value.
9809 *
9810 * **Details**
9811 *
9812 * Decoding maps a missing key or a present `undefined` value to `None`, and
9813 * maps all other values to `Some`. Encoding maps `None` to a missing key and
9814 * maps `Some` to its value.
9815 *
9816 * @category schemas
9817 * @since 4.0.0
9818 */
9819export function OptionFromOptional<S extends Constraint>(schema: S): OptionFromOptional<S> {
9820 return optional(schema).pipe(decodeTo(

Callers

nothing calls this directly

Calls 12

entriesArbitraryFunction · 0.85
keyFunction · 0.85
someMethod · 0.80
joinMethod · 0.80
declareConstructorFunction · 0.70
TupleFunction · 0.70
linkFunction · 0.70
valueFunction · 0.70
makeFunction · 0.70
transformMethod · 0.65
mapMethod · 0.65
failMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…