Skip to content

Commit

Permalink
make from array
Browse files Browse the repository at this point in the history
  • Loading branch information
ettoreleandrotognoli committed Nov 2, 2018
1 parent 2c642d0 commit 30b44a4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ class ObjectParser<E> implements Parser<E> {
}


export function toArray<E>(parser: FunctionalParser<E>): FunctionalParser<Array<E>> {
return (any: Array<any>, repository: ParserRepository) => any.map(it => parser(it, repository));
}

export function makeFromType<E>(type: Type<E>): FunctionalParser<E> {
return (it) => {
it.__proto__ = type.prototype;
Expand Down

0 comments on commit 30b44a4

Please sign in to comment.