Skip to main content

arrayValue

function

Build a SerializationSchema for an array whose entries are each coerced by `item`. A non-array value (including `undefined`) yields the empty array, which is the recoverable default.

function arrayValue<T, In = T>(item: SerializationSchema<T, never, In>): SerializationSchema<T[], never, readonly In[]>

Import

import { arrayValue } from '@modular/sdk/editor';

Notes

example
```ts const parseIds = arrayValue(stringValue()); // ^? SerializationSchema<string[]> parseIds(['a', 'b']); // ['a', 'b'] parseIds('nope'); // [] ```
__NO_SIDE_EFFECTS__