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

Function ArrayEnsure

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

Source from the content-addressed store, hash-verified

1642 * @since 3.10.0
1643 */
1644export function ArrayEnsure<Value extends Schema.Any>(value: Value): ArrayEnsure<Value> {
1645 return transform(Union(value, Array$(value)), Array$(typeSchema(asSchema(value))), {
1646 strict: true,
1647 decode: (i) => array_.ensure(i),
1648 encode: (a) => a.length === 1 ? a[0] : a
1649 })
1650}
1651
1652/**
1653 * @category api interface

Callers

nothing calls this directly

Calls 5

typeSchemaFunction · 0.85
asSchemaFunction · 0.85
transformInterface · 0.70
UnionFunction · 0.70
Array$Function · 0.70

Tested by

no test coverage detected