CARROT-1018: use an object instead of an array for more explicit code.
The "in" operator is pretty slow, replace with typeof.