mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-05-03 21:19:30 +08:00
24 lines
438 B
Text
24 lines
438 B
Text
'use strict';
|
|
|
|
// https://262.ecma-international.org/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';
|
|
}
|
|
};
|