diff --git a/src/parser.ts b/src/parser.ts index cf92ae2..91719bd 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -64,6 +64,10 @@ class ObjectParser implements Parser { } +export function toArray(parser: FunctionalParser): FunctionalParser> { + return (any: Array, repository: ParserRepository) => any.map(it => parser(it, repository)); +} + export function makeFromType(type: Type): FunctionalParser { return (it) => { it.__proto__ = type.prototype;