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.

toKeyAlias.js 1013B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = toKeyAlias;
  6. var _generated = require("../validators/generated");
  7. var _cloneNode = require("../clone/cloneNode");
  8. var _removePropertiesDeep = require("../modifications/removePropertiesDeep");
  9. function toKeyAlias(node, key = node.key) {
  10. let alias;
  11. if (node.kind === "method") {
  12. return toKeyAlias.increment() + "";
  13. } else if ((0, _generated.isIdentifier)(key)) {
  14. alias = key.name;
  15. } else if ((0, _generated.isStringLiteral)(key)) {
  16. alias = JSON.stringify(key.value);
  17. } else {
  18. alias = JSON.stringify((0, _removePropertiesDeep.default)((0, _cloneNode.default)(key)));
  19. }
  20. if (node.computed) {
  21. alias = `[${alias}]`;
  22. }
  23. if (node.static) {
  24. alias = `static:${alias}`;
  25. }
  26. return alias;
  27. }
  28. toKeyAlias.uid = 0;
  29. toKeyAlias.increment = function () {
  30. if (toKeyAlias.uid >= Number.MAX_SAFE_INTEGER) {
  31. return toKeyAlias.uid = 0;
  32. } else {
  33. return toKeyAlias.uid++;
  34. }
  35. };