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.

reflect-metadata.js 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`
  2. var Map = require('../modules/es.map');
  3. var WeakMap = require('../modules/es.weak-map');
  4. var shared = require('../internals/shared');
  5. var metadata = shared('metadata');
  6. var store = metadata.store || (metadata.store = new WeakMap());
  7. var getOrCreateMetadataMap = function (target, targetKey, create) {
  8. var targetMetadata = store.get(target);
  9. if (!targetMetadata) {
  10. if (!create) return;
  11. store.set(target, targetMetadata = new Map());
  12. }
  13. var keyMetadata = targetMetadata.get(targetKey);
  14. if (!keyMetadata) {
  15. if (!create) return;
  16. targetMetadata.set(targetKey, keyMetadata = new Map());
  17. } return keyMetadata;
  18. };
  19. var ordinaryHasOwnMetadata = function (MetadataKey, O, P) {
  20. var metadataMap = getOrCreateMetadataMap(O, P, false);
  21. return metadataMap === undefined ? false : metadataMap.has(MetadataKey);
  22. };
  23. var ordinaryGetOwnMetadata = function (MetadataKey, O, P) {
  24. var metadataMap = getOrCreateMetadataMap(O, P, false);
  25. return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey);
  26. };
  27. var ordinaryDefineOwnMetadata = function (MetadataKey, MetadataValue, O, P) {
  28. getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue);
  29. };
  30. var ordinaryOwnMetadataKeys = function (target, targetKey) {
  31. var metadataMap = getOrCreateMetadataMap(target, targetKey, false);
  32. var keys = [];
  33. if (metadataMap) metadataMap.forEach(function (_, key) { keys.push(key); });
  34. return keys;
  35. };
  36. var toMetadataKey = function (it) {
  37. return it === undefined || typeof it == 'symbol' ? it : String(it);
  38. };
  39. module.exports = {
  40. store: store,
  41. getMap: getOrCreateMetadataMap,
  42. has: ordinaryHasOwnMetadata,
  43. get: ordinaryGetOwnMetadata,
  44. set: ordinaryDefineOwnMetadata,
  45. keys: ordinaryOwnMetadataKeys,
  46. toKey: toMetadataKey
  47. };