dist/modules/type.js
function getType(val, strict, def) {
    if (is_1.isString(strict)) {
        def = strict;
        strict = undefined;
    }
    var type = typeof val;
    var parse = !is_1.isValue(strict) ? true : false;
    function isKnown() {
        return (type === 'undefined' ||
            (type !== 'object' &&
                type !== 'number' &&
                type !== 'string'));
    }
    // If not 'object', 'number' or 'string' just
    // return the type, numbers, objects and strings
    // should fall through for more specific type.
    if (isKnown())
        return type;
    if (is_1.isNull(val)) {
        return 'null';
    }
    else if (is_1.isDate(val)) {
        return 'date';
    }
    else if (is_1.isNumber(val)) {
        if (strict)
            return 'number';
        if (is_1.isFloat(val))
            return 'float';
        if (is_1.isInteger(val))
            return 'integer';
        /* istanbul ignore next */
        return 'number';
    }
    else if (is_1.isPlainObject(val)) {
        if (strict)
            return type;
        return 'literal';
    }
    else if (is_1.isError(val)) {
        return 'error';
    }
    else if (is_1.isRegExp(val)) {
        return 'regexp';
    }
    else if (is_1.isArray(val)) {
        return 'array';
    }
    else if (is_1.isString(val)) {
        return 'string';
    }
    else if (val.constructor && val.constructor.name) {
        if (strict)
            return type;
        return val.constructor.name;
    }
    /* istanbul ignore next */
    return def || 'any';
}
function getType(val, strict, def) {
    if (is_1.isString(strict)) {
        def = strict;
        strict = undefined;
    }
    var type = typeof val;
    var parse = !is_1.isValue(strict) ? true : false;
    function isKnown() {
        return (type === 'undefined' ||
            (type !== 'object' &&
                type !== 'number' &&
                type !== 'string'));
    }
    // If not 'object', 'number' or 'string' just
    // return the type, numbers, objects and strings
    // should fall through for more specific type.
    if (isKnown())
        return type;
    if (is_1.isNull(val)) {
        return 'null';
    }
    else if (is_1.isDate(val)) {
        return 'date';
    }
    else if (is_1.isNumber(val)) {
        if (strict)
            return 'number';
        if (is_1.isFloat(val))
            return 'float';
        if (is_1.isInteger(val))
            return 'integer';
        /* istanbul ignore next */
        return 'number';
    }
    else if (is_1.isPlainObject(val)) {
        if (strict)
            return type;
        return 'literal';
    }
    else if (is_1.isError(val)) {
        return 'error';
    }
    else if (is_1.isRegExp(val)) {
        return 'regexp';
    }
    else if (is_1.isArray(val)) {
        return 'array';
    }
    else if (is_1.isString(val)) {
        return 'string';
    }
    else if (val.constructor && val.constructor.name) {
        if (strict)
            return type;
        return val.constructor.name;
    }
    /* istanbul ignore next */
    return def || 'any';
}
function getType ( val , strict , def ) { if ( is_1 . isString ( strict ) ) { def = strict ; strict = undefined ; } var type = typeof val ; var parse = ! is_1 . isValue ( strict ) ? true : false ; function isKnown ( ) { return ( type === 'undefined' || ( type !== 'object' && type !== 'number' && type !== 'string' ) ) ; } // If not 'object', 'number' or 'string' just // return the type, numbers, objects and strings // should fall through for more specific type. if ( isKnown ( ) ) return type ; if ( is_1 . isNull ( val ) ) { return 'null' ; } else if ( is_1 . isDate ( val ) ) { return 'date' ; } else if ( is_1 . isNumber ( val ) ) { if ( strict ) return 'number' ; if ( is_1 . isFloat ( val ) ) return 'float' ; if ( is_1 . isInteger ( val ) ) return 'integer' ; /* istanbul ignore next */ return 'number' ; } else if ( is_1 . isPlainObject ( val ) ) { if ( strict ) return type ; return 'literal' ; } else if ( is_1 . isError ( val ) ) { return 'error' ; } else if ( is_1 . isRegExp ( val ) ) { return 'regexp' ; } else if ( is_1 . isArray ( val ) ) { return 'array' ; } else if ( is_1 . isString ( val ) ) { return 'string' ; } else if ( val . constructor && val . constructor . name ) { if ( strict ) return type ; return val . constructor . name ; } /* istanbul ignore next */ return def || 'any' ; }
Get Type
Gets the type of the provided value.

Value                Type                  Strict
-------------------------------------------------
{}                   literal               object
true                 boolean               boolean
'true'               boolean               string
25                   integer               number
25.5                 float                 number
new Date()           date                  date
'01/01/2017'         date                  string
RegExp               regexp                regexp
'/^test/g'           regexp                string
null                 null                  null
function() {}        function              function
[]                   array                 array
'some string'        string                string

@param val the object to get type from.
@param strict when true returns the strict type see examples.
@param def the optional string name for unknown types.
Get Type Gets the type of the provided value .