superstruct-chain
A simple module that enables the chaining of calls with superstruct, so you can avoid parenthesis hell in your object definitions.
Usage
import { string, number, object } from 'superstruct';
import 'superstruct-chain';
const Config = object({
port: number().defaulted(80),
address: string().optional(),
});
Methods added
The following methods are monkey-patched into the prototype of Struct
:
- optional
- defaulted
- coerce
- refine
- masked
- trimmed
- empty
- min
- below
- pattern
- size
- assign
- omit
- partial
- pick
These methods should be invoked without the first argument of their functional counterpart.