Bug: `get` does not get the actual value when it's false
Redsandro opened this issue · comments
false
is a distinct value for boolean, not the same as null
.
But for get
, false
is assumed undefined
and it will fall back to the default:
The default
does not register for get
, but it does for value
.
Lazy({ hasShotgun: false }).defaults({ hasShotgun: null }).value()
// Object {hasShotgun: false}
Lazy({ hasShotgun: false }).defaults({ hasShotgun: null }).get('hasShotgun')
// null
// EXPECTED:
// false
Perhaps more dramatically:
Lazy({ "rm -rf": false }).defaults({ "rm -rf": true }).value()
// Object {rm -rf: false}
Lazy({ "rm -rf": false }).defaults({ "rm -rf": true }).get('rm -rf')
// true
Good catch! This appears to be a bug specific to the results of assign
and default
; I will fix.