esnext.reflect.metadata.js 619 B

1234567891011121314151617
  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 ordinaryDefineOwnMetadata = ReflectMetadataModule.set;
  7. // `Reflect.metadata` method
  8. // https://github.com/rbuckton/reflect-metadata
  9. $({ target: 'Reflect', stat: true }, {
  10. metadata: function metadata(metadataKey, metadataValue) {
  11. return function decorator(target, key) {
  12. ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), toMetadataKey(key));
  13. };
  14. }
  15. });