variable-type
Version:
Runtime type checking for variable and similar objects.
27 lines • 693 B
JavaScript
;
/**
* Created by hustcc on 17/08/01.
*/
Object.defineProperty(exports, "__esModule", { value: true });
/**
* what( v ) -> String : get what is the type of the input var.
* @param v: the var which want to typeof
* @returns {string}
* https://github.com/hustcc/what.js
*/
function what(v) {
if (v === null)
return 'null';
if (v === undefined)
return 'undefined';
var t = typeof v;
// performance opt
if (t === 'string' ||
t === 'number' ||
t === 'function' ||
t === 'boolean')
return t;
return ({}).toString.call(v).slice(8, -1).toLowerCase();
}
exports.default = what;
//# sourceMappingURL=what.js.map