BlairAllegroTech / js-data-jsonapi

JsonApi Adapter for js-data
MIT License
15 stars 5 forks source link

Error on Null Values #8

Closed rgant closed 8 years ago

rgant commented 8 years ago

Some of the fields in my models have the value of null. This causes an error because null doesn't have a constructor property. https://github.com/BlairAllegroTech/js-data-jsonapi/blob/d67ff61c7dff78257b416927d23e1c32c87a76e0/src/JsonApiSerializer.ts#L621

I think that this: if (val.constructor === ModelPlaceHolder) {

Needs to change to this: if (val !== null && val.constructor === ModelPlaceHolder) {

BlairAllegroTech commented 8 years ago

Thanks @rgant , i appreciate the feedback!