es7.reflect.metadata.js 498 B

123456789101112131415
  1. var $metadata = require('./_metadata');
  2. var anObject = require('./_an-object');
  3. var aFunction = require('./_a-function');
  4. var toMetaKey = $metadata.key;
  5. var ordinaryDefineOwnMetadata = $metadata.set;
  6. $metadata.exp({ metadata: function metadata(metadataKey, metadataValue) {
  7. return function decorator(target, targetKey) {
  8. ordinaryDefineOwnMetadata(
  9. metadataKey, metadataValue,
  10. (targetKey !== undefined ? anObject : aFunction)(target),
  11. toMetaKey(targetKey)
  12. );
  13. };
  14. } });