Fixed missing typeof

Added missing typeof, and moved typeof evaluation out of the map.
isString makes more easy to read and understand.