adaltas / node-csv-stringify

CSV stringifier implementing the Node.js `stream.Transform` API
https://csv.js.org/stringify/
186 stars 52 forks source link

Fix get on undefined objects - Breaking change in 5.3.1 #97

Closed Brunomachadob closed 5 years ago

Brunomachadob commented 5 years ago

Hi!

My unit tests started breaking with the update 5.3.0 -> 5.3.1.

It is related to the new get method that was extracted from lodash, where you check for object !== null, while in my case, the value is undefined, thus throwing TypeError: Cannot read property '2Template' of undefined on the line after.

(I took a while until understand that I should change the coffee.md file until getting it to work I have never worked with coffee before haha)

I'm also pretty unsure about where/how to unit test this thing, I didn't find a lot of test cases with objects. If this is a must, please help me how to approach this.

wdavidw commented 5 years ago

I will take care of the unit test and the condition shall be while object? and index < length where ? in coffee check for both null and boolean. I'll try to get it soon, by tomorrow but currently on holiday with a very weak internet connection.

wdavidw commented 5 years ago

I have just released version 5.3.2 with your patch and an additional unit test covering it. Sorry for the inconvenience.