falsy JavaScript attribute values are getting set to null if nullIfMissing flag is set
hinsenchan opened this issue · comments
Hinsen Chan commented
I was trying to set nulls for missing attributes for a boolean
and number
attribute where the values are false
and 0
respectively. The serializer converted them to nulls because of the falsy
value comparison. I believe it is caused by the two lines below...anyone else experience the same thing?
jsonapi-serializer/lib/serializer-utils.js
line 201 !dest[attr]
line 295 !record[attribute]
I think the fix is likely relatively simple since we're already using Lodash if we can agree missing means undefined?
jsonapi-serializer/lib/serializer-utils.js
line 201 isUndefined(dest[attr])
line 295 isUndefined(record[attribute])