Skip to content

Commit

Permalink
do not rely on isArray value
Browse files Browse the repository at this point in the history
  • Loading branch information
gr0uch committed Aug 25, 2015
1 parent b85d2b1 commit b008fc8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lib/serializer/serializers/ad_hoc/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,8 @@ class AdHocSerializer extends DefaultSerializer {
const value = record[field]
const fieldDefinition = fields[field] || {}
const fieldType = fieldDefinition[keys.type]
const fieldIsArray = fieldDefinition[keys.isArray]

record[field] = fieldIsArray ?
record[field] = Array.isArray(value) ?
value.map(cast(fieldType, options)) :
castValue(value, fieldType, options)
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "fortune",
"description": "High-level I/O for web applications.",
"version": "1.2.0",
"version": "1.2.1",
"license": "MIT",
"author": {
"email": "[email protected]",
Expand Down
1 change: 1 addition & 0 deletions test/integration/test_instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default options => {
picture: { type: Buffer },
createdAt: { type: Date },
lastModified: { type: Date },
nicknames: { type: String, isArray: true },

// Many to many
friends: { link: 'user', inverse: 'friends', isArray: true },
Expand Down

0 comments on commit b008fc8

Please sign in to comment.