I'm using Vogel.js to connect to Amazon DynamoDB. It's great, however one thing I'm struggling with is that a call such as
MyEntity.get({ my_key: keyValue }, callback);
will either return null if there is no results, or will return a wrapper object.
If I just want to read MyEntity
as an object, it appears that in my callback I then have to do
const myEntityAsAnObject = queryResult.get();
however, this will throw if there was no results. So then I have to do some null checking before I do the get. Which I could use lodash or something for, but I'm wondering - is there a nicer way to do this? something like
MyEntity.getAsObject({ my_key: keyValue }, callback);
that will always return the unwrapped object?