it would seen that both these if statements could be expressed as simply:

`````
if (!result[key]) return;
`````

As (!result[key]) will match (result[key] === undefined) and (!result[key].length) as far as I can see.