You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
447 B
24 lines
447 B
'use strict';
|
|
|
|
// https://www.ecma-international.org/ecma-262/5.1/#sec-8
|
|
|
|
module.exports = function Type(x) {
|
|
if (x === null) {
|
|
return 'Null';
|
|
}
|
|
if (typeof x === 'undefined') {
|
|
return 'Undefined';
|
|
}
|
|
if (typeof x === 'function' || typeof x === 'object') {
|
|
return 'Object';
|
|
}
|
|
if (typeof x === 'number') {
|
|
return 'Number';
|
|
}
|
|
if (typeof x === 'boolean') {
|
|
return 'Boolean';
|
|
}
|
|
if (typeof x === 'string') {
|
|
return 'String';
|
|
}
|
|
};
|
|
|