Node-Red configuration
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

reflect-metadata.js 2.0KB

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