Sometimes we do everything right, yet we don't have the expected results.
When working on a NodeJS application, do you often get an undefined value even if it exists in the respective object?
This happens to me all the time.
I am adding a small feature to an existing NodeJS application. We are using MongoDB amongst other databases. I've added the value in the respective row, the schema and appended the class interface as well since we are using TypeScript.
However, when referring the value itself, it's undefined. Therefore the function which uses this value becomes erratic, yet it's present when logging the object.
How to explain that?
I just apply my helper method, called objectify, which is basically:
As a result, we have the value present as expected.