Property lookup on booleans

Performs a lot of dynamic lookups on the Boolean.prototype, as the ToBoolean operation let's true pass for obj (which might itself be concerning that this can be a boolean). Instead of the coercion, the code should properly check for valid objects via typeof and strict equality with null comparison.

Example:

Use below

if (typeof obj === 'object' && obj !== null) {
  return obj[key] || 0
}

return 0

Instead of

return (obj && obj[key]) || 0