Guest User

Untitled

a guest
Jan 20th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. function isString(target) {
  2. return isType(target, 'String')
  3. }
  4.  
  5. function isNumber(target) {
  6. return isType(target, 'Number')
  7. }
  8.  
  9. function isDate(target) {
  10. return isType(target, 'Date')
  11. }
  12.  
  13. function isFunction(target) {
  14. return isType(target, 'Function')
  15. }
  16.  
  17. function isObject(target) {
  18. return isType(target, 'Object')
  19. }
  20.  
  21. function isArray(target) {
  22. return isType(target, 'Array')
  23. }
  24.  
  25. function isType(target, type) {
  26. return Object.prototype.toString.call(target) === `[object ${type}]` ? true : false
  27. }
Add Comment
Please, Sign In to add comment