Node-Red configuration
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.

esnext.reflect.delete-metadata.js 977B

12345678910111213141516171819202122
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var ReflectMetadataModule = require('../internals/reflect-metadata');
  4. var anObject = require('../internals/an-object');
  5. var toMetadataKey = ReflectMetadataModule.toKey;
  6. var getOrCreateMetadataMap = ReflectMetadataModule.getMap;
  7. var store = ReflectMetadataModule.store;
  8. // `Reflect.deleteMetadata` method
  9. // https://github.com/rbuckton/reflect-metadata
  10. $({ target: 'Reflect', stat: true }, {
  11. deleteMetadata: function deleteMetadata(metadataKey, target /* , targetKey */) {
  12. var targetKey = arguments.length < 3 ? undefined : toMetadataKey(arguments[2]);
  13. var metadataMap = getOrCreateMetadataMap(anObject(target), targetKey, false);
  14. if (metadataMap === undefined || !metadataMap['delete'](metadataKey)) return false;
  15. if (metadataMap.size) return true;
  16. var targetMetadata = store.get(target);
  17. targetMetadata['delete'](targetKey);
  18. return !!targetMetadata.size || store['delete'](target);
  19. }
  20. });