add type support for undefined, RegExp; add check for function value