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.

Type.js 447B

123456789101112131415161718192021222324
  1. 'use strict';
  2. // https://www.ecma-international.org/ecma-262/5.1/#sec-8
  3. module.exports = function Type(x) {
  4. if (x === null) {
  5. return 'Null';
  6. }
  7. if (typeof x === 'undefined') {
  8. return 'Undefined';
  9. }
  10. if (typeof x === 'function' || typeof x === 'object') {
  11. return 'Object';
  12. }
  13. if (typeof x === 'number') {
  14. return 'Number';
  15. }
  16. if (typeof x === 'boolean') {
  17. return 'Boolean';
  18. }
  19. if (typeof x === 'string') {
  20. return 'String';
  21. }
  22. };