let toString = Object.prototype.toString,
    isArray = Array.isArray,
    type = variable => toString.call(variable).slice(8, -1).toLowerCase(),
    is = {
        isUndef(variable) {
            return variable === undefined
        },
        isNull(variable) {
            return variable === null
        },
        isStr(variable) {
            return type(variable) === 'string'
        },
        isNum(variable) {
            return type(variable) === 'number'
        },
        isBool(variable) {
            return type(variable) === 'boolean'
        },
        isArr(variable) {
            return isArray(variable)
        },
        isFun(variable) {
            return type(variable) === 'function'
        },
        isDate(variable) {
            return type(variable) === 'date'
        },
        isReg(variable) {
            return type(variable) === 'regexp'
        },
        isErr(variable) {
            return type(variable) === 'error'
        },
        isSym(variable) {
            return type(variable) === 'symbol'
        },
        isObj(variable) {
            return type(variable) === 'object'
        }
    }

Object.assign(type, is)

export default type

@@ -1,8 +1,135 @@
+/**%0A * type v1.0.0 (https://github.com/chenBright/type)%0A * Copyright 2013 chenBright. All Rights Reserved%0A * MIT Licensed%0A */%0A%0A
 let toSt
@@ -277,16 +277,42 @@
  is = %7B%0A
+        // %E5%88%A4%E6%96%AD%E6%98%AF%E5%90%A6%E4%B8%BAundefined%0A
         
@@ -376,32 +376,53 @@
 ined%0A        %7D,%0A
+        // %E5%88%A4%E6%96%AD%E6%98%AF%E5%90%A6%E4%B8%BAnull%0A
         isNull(v
@@ -472,32 +472,52 @@
 null%0A        %7D,%0A
+        // %E5%88%A4%E6%96%AD%E6%98%AF%E5%90%A6%E4%B8%BA%E5%AD%97%E7%AC%A6%E4%B8%B2%0A
         isStr(va
@@ -576,32 +576,51 @@
 ing'%0A        %7D,%0A
+        // %E5%88%A4%E6%96%AD%E6%98%AF%E5%90%A6%E4%B8%BA%E6%95%B0%E5%AD%97%0A
         isNum(va
@@ -679,32 +679,53 @@
 ber'%0A        %7D,%0A
+        // %E5%88%A4%E6%96%AD%E6%98%AF%E5%90%A6%E4%B8%BA%E5%B8%83%E5%B0%94%E7%B1%BB%E5%9E%8B%0A
         isBool(v
@@ -786,32 +786,51 @@
 ean'%0A        %7D,%0A
+        // %E5%88%A4%E6%96%AD%E6%98%AF%E5%90%A6%E4%B8%BA%E6%95%B0%E7%BB%84%0A
         isArr(va
@@ -879,32 +879,51 @@
 ble)%0A        %7D,%0A
+        // %E5%88%A4%E6%96%AD%E6%98%AF%E5%90%A6%E4%B8%BA%E5%87%BD%E6%95%B0%0A
         isFun(va
@@ -984,32 +984,51 @@
 ion'%0A        %7D,%0A
+        // %E5%88%A4%E6%96%AD%E6%98%AF%E5%90%A6%E4%B8%BA%E6%97%A5%E6%9C%9F%0A
         isDate(v
@@ -1086,32 +1086,51 @@
 ate'%0A        %7D,%0A
+        // %E5%88%A4%E6%96%AD%E6%98%AF%E5%90%A6%E4%B8%BA%E6%AD%A3%E5%88%99%0A
         isReg(va
@@ -1189,32 +1189,56 @@
 exp'%0A        %7D,%0A
+        // %E5%88%A4%E6%96%AD%E6%98%AF%E5%90%A6%E4%B8%BAError%E7%B1%BB%E5%9E%8B%0A
         isErr(va
@@ -1296,32 +1296,57 @@
 ror'%0A        %7D,%0A
+        // %E5%88%A4%E6%96%AD%E6%98%AF%E5%90%A6%E4%B8%BASymbol%E7%B1%BB%E5%9E%8B%0A
         isSym(va
@@ -1405,32 +1405,57 @@
 bol'%0A        %7D,%0A
+        // %E5%88%A4%E6%96%AD%E6%98%AF%E5%90%A6%E4%B8%BAObject%E7%B1%BB%E5%9E%8B%0A
         isObj(va
@@ -1528,16 +1528,37 @@
 %0A    %7D%0A%0A
+// %E5%B0%86is%E5%AF%B9%E8%B1%A1%E4%B8%AD%E7%9A%84%E6%96%B9%E6%B3%95%E6%8B%B7%E8%B4%9D%E5%88%B0type%E4%B8%AD%0A
 Object.a

add comment