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 21 221   1               1 271 16 255 8   247     1    
define(function () {
 
    var _rKind = /^\[object (.*)\]$/,
        _toString = Object.prototype.toString,
        UNDEF;
 
    /**
     * Gets the "kind" of value. (e.g. "String", "Number", etc)
     * @version 0.1.0 (2011/10/31)
     */
    function kindOf(val) {
        if (val === null) {
            return 'Null';
        } else if (val === UNDEF) {
            return 'Undefined';
        } else {
            return _rKind.exec( _toString.call(val) )[1];
        }
    }
    return kindOf;
});