Consider using function to check type of variable

I think we should use function to check type of variable like underscore or lodash to make is more flexible and easier to test.