esnext.reflect.metadata.js 605 B

12345678910111213141516
  1. var $ = require('../internals/export');
  2. var ReflectMetadataModule = require('../internals/reflect-metadata');
  3. var anObject = require('../internals/an-object');
  4. var toMetadataKey = ReflectMetadataModule.toKey;
  5. var ordinaryDefineOwnMetadata = ReflectMetadataModule.set;
  6. // `Reflect.metadata` method
  7. // https://github.com/rbuckton/reflect-metadata
  8. $({ target: 'Reflect', stat: true }, {
  9. metadata: function metadata(metadataKey, metadataValue) {
  10. return function decorator(target, key) {
  11. ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), toMetadataKey(key));
  12. };
  13. }
  14. });