Idiomatically for future reference, I think JS does better with lists/objects/fancy new Sets than bit-masks.  No need to change this.