Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

index.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', {
  3. value: true
  4. });
  5. exports.getType = getType;
  6. exports.isPrimitive = void 0;
  7. /**
  8. * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
  9. *
  10. * This source code is licensed under the MIT license found in the
  11. * LICENSE file in the root directory of this source tree.
  12. */
  13. // get the type of a value with handling the edge cases like `typeof []`
  14. // and `typeof null`
  15. function getType(value) {
  16. if (value === undefined) {
  17. return 'undefined';
  18. } else if (value === null) {
  19. return 'null';
  20. } else if (Array.isArray(value)) {
  21. return 'array';
  22. } else if (typeof value === 'boolean') {
  23. return 'boolean';
  24. } else if (typeof value === 'function') {
  25. return 'function';
  26. } else if (typeof value === 'number') {
  27. return 'number';
  28. } else if (typeof value === 'string') {
  29. return 'string';
  30. } else if (typeof value === 'bigint') {
  31. return 'bigint';
  32. } else if (typeof value === 'object') {
  33. if (value != null) {
  34. if (value.constructor === RegExp) {
  35. return 'regexp';
  36. } else if (value.constructor === Map) {
  37. return 'map';
  38. } else if (value.constructor === Set) {
  39. return 'set';
  40. } else if (value.constructor === Date) {
  41. return 'date';
  42. }
  43. }
  44. return 'object';
  45. } else if (typeof value === 'symbol') {
  46. return 'symbol';
  47. }
  48. throw new Error(`value of unknown type: ${value}`);
  49. }
  50. const isPrimitive = value => Object(value) !== value;
  51. exports.isPrimitive = isPrimitive;