esnext.reflect.get-own-metadata.js 641 B

123456789101112131415
  1. var $ = require('../internals/export');
  2. var ReflectMetadataModule = require('../internals/reflect-metadata');
  3. var anObject = require('../internals/an-object');
  4. var ordinaryGetOwnMetadata = ReflectMetadataModule.get;
  5. var toMetadataKey = ReflectMetadataModule.toKey;
  6. // `Reflect.getOwnMetadata` method
  7. // https://github.com/rbuckton/reflect-metadata
  8. $({ target: 'Reflect', stat: true }, {
  9. getOwnMetadata: function getOwnMetadata(metadataKey, target /* , targetKey */) {
  10. var targetKey = arguments.length < 3 ? undefined : toMetadataKey(arguments[2]);
  11. return ordinaryGetOwnMetadata(metadataKey, anObject(target), targetKey);
  12. }
  13. });