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

Function NonEmptyArrayEnsure

packages/effect/src/Schema.ts:1664–1670  ·  view source on GitHub ↗
(value: Value)

Source from the content-addressed store, hash-verified

1662 * @since 3.10.0
1663 */
1664export function NonEmptyArrayEnsure<Value extends Schema.Any>(value: Value): NonEmptyArrayEnsure<Value> {
1665 return transform(Union(value, NonEmptyArray(value)), NonEmptyArray(typeSchema(asSchema(value))), {
1666 strict: true,
1667 decode: (i) => array_.isNonEmptyReadonlyArray(i) ? i : array_.of(i),
1668 encode: (a) => a.length === 1 ? a[0] : a
1669 })
1670}
1671
1672/**
1673 * @since 3.10.0

Callers

nothing calls this directly

Calls 6

typeSchemaFunction · 0.85
asSchemaFunction · 0.85
transformInterface · 0.70
UnionFunction · 0.70
NonEmptyArrayFunction · 0.70
ofMethod · 0.65

Tested by

no test coverage detected