This could be done fairly easily using a Proxy for the index:
this.idx.gender = new Proxy({}, {
get: function(obj, prop) {
if (prop in obj) return obj[prop];
else return [];
}
});
This technically changes the client-facing API, and so it should be a bump to 0.2.0 instead of 0.1.1. Arguably it could be said that the previous behavior was a bug, though, justifying 0.1.1... I'll probably just bump to 0.2.0 anyway, though.
Currently because I'm using JavaScript Objects for the index, if a value does not exist then
undefined
is returned. For example:Desired output would be:
This could be done fairly easily using a
Proxy
for the index:This technically changes the client-facing API, and so it should be a bump to
0.2.0
instead of0.1.1
. Arguably it could be said that the previous behavior was a bug, though, justifying0.1.1
... I'll probably just bump to0.2.0
anyway, though.