use lodash helper functions instead of ugly typeof calls