There is very little you need to attach to Boolean, as it is a very simple object. I have only found two methods that I like to attach to the Boolean
Object: is
and get
. The is
method is a type detection like I have attached to other native JavaScript objects. The get
method is to convert falsy/truthy values into false
and true
. While this isnt necessary because you can use "! yourObject", however I frequently like to use strict, type comparisons operations, such as
=== and
!==.
Check out object.js here and the unit test here.
As a side note, I have been updating the blog layout a bit. Hopefully, I am making this blog more useful.