lx-valid.js
function getType(value) {
        // inspired by http://techblog.badoo.com/blog/2013/11/01/type-checking-in-javascript/

        // handle null in old IE
        if (value === null) {
            return 'null';
        }

        // handle DOM elements
        if (value && (value.nodeType === 1 || value.nodeType === 9)) {
            return 'element';
        }

        var s = Object.prototype.toString.call(value);
        var type = s.match(/\[object (.*?)\]/)[1].toLowerCase();

        // handle NaN and Infinity
        if (type === 'number') {
            if (isNaN(value)) {
                return 'nan';
            }
            if (!isFinite(value)) {
                return 'infinity';
            }
        }

        return type;
    }
function getType(value) {
        // inspired by http://techblog.badoo.com/blog/2013/11/01/type-checking-in-javascript/

        // handle null in old IE
        if (value === null) {
            return 'null';
        }

        // handle DOM elements
        if (value && (value.nodeType === 1 || value.nodeType === 9)) {
            return 'element';
        }

        var s = Object.prototype.toString.call(value);
        var type = s.match(/\[object (.*?)\]/)[1].toLowerCase();

        // handle NaN and Infinity
        if (type === 'number') {
            if (isNaN(value)) {
                return 'nan';
            }
            if (!isFinite(value)) {
                return 'infinity';
            }
        }

        return type;
    }
function getType ( value ) { // inspired by http://techblog.badoo.com/blog/2013/11/01/type-checking-in-javascript/ // handle null in old IE if ( value === null ) { return 'null' ; } // handle DOM elements if ( value && ( value . nodeType === 1 || value . nodeType === 9 ) ) { return 'element' ; } var s = Object . prototype . toString . call ( value ) ; var type = s . match ( / \[object (.*?)\] / ) [ 1 ] . toLowerCase ( ) ; // handle NaN and Infinity if ( type === 'number' ) { if ( isNaN ( value ) ) { return 'nan' ; } if ( ! isFinite ( value ) ) { return 'infinity' ; } } return type ; }
Gets the type of the value in lower case.

@param {*} value The value to test.
@returns {string}
Gets the type of the value in lower case .