Skip to content

Commit 22e7161

Browse files
author
0x8890
committed
fix faulty payload check
1 parent bc2f21b commit 22e7161

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

doc/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Changelog
22

33

4+
##### 1.3.8 (2015-09-10)
5+
- Fix: faulty check for invalid create/update payloads.
6+
7+
48
##### 1.3.7 (2015-09-10)
59
- Fix: check for invalid create/update payloads which have the same ID in multiple records for a to-one relationship.
610

lib/dispatch/validate_records.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ export default function validateRecords (records, fields, links) {
2929
toOneMap[field] = []
3030

3131
for (let record of records) {
32-
const ids = Array.isArray(record[field]) ?
33-
record[field] : [ record[field] ]
32+
const value = record[field]
33+
const ids = Array.isArray(value) ? value : value ? [ value ] : []
3434

3535
for (let id of ids)
3636
if (!includes(toOneMap[field], id)) toOneMap[field].push(id)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "fortune",
33
"description": "High-level I/O for web applications.",
4-
"version": "1.3.7",
4+
"version": "1.3.8",
55
"license": "MIT",
66
"author": {
77
"email": "[email protected]",

0 commit comments

Comments
 (0)