Skip to content

Commit

Permalink
Fix the forwarding of options to item schema's with IterableSchema
Browse files Browse the repository at this point in the history
  • Loading branch information
JaapRood committed Apr 3, 2017
1 parent 62fbff0 commit f0270bb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ internals.IterableSchema = function(iterable, itemSchema) {

_assign(this, {
getItemSchema: () => itemSchema,
factory: (val) => iterable(val).map(itemSchema.factory || internals.idenity),
serialize: (val) => val.map(itemSchema.serialize || internals.idenity).toJS()
factory: (val, ...otherArgs) => {
const factory = itemSchema.factory || internals.idenity
return iterable(val).map((item) => factory(item, ...otherArgs))
},
serialize: (val, ...otherArgs) => {
const serialize = itemSchema.serialize || internals.idenity
return val.map((item) => serialize(item, ...otherArgs)).toJS()
}
})
}

Expand Down

0 comments on commit f0270bb

Please sign in to comment.