Code coverage report for lang/kindOf.js

Statements: 100% (10 / 10)      Branches: 100% (4 / 4)      Functions: 100% (3 / 3)      Lines: 100% (9 / 9)     

All files » lang/ » kindOf.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 211   1             1 341 16 325 8   317     1    
define(function () {
 
    var _rKind = /^\[object (.*)\]$/,
        _toString = Object.prototype.toString,
        UNDEF;
 
    /**
     * Gets the "kind" of value. (e.g. "String", "Number", etc)
     */
    function kindOf(val) {
        if (val === null) {
            return 'Null';
        } else if (val === UNDEF) {
            return 'Undefined';
        } else {
            return _rKind.exec( _toString.call(val) )[1];
        }
    }
    return kindOf;
});