Last change
on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
959 bytes
|
Line | |
---|
1 | var $ = require('../internals/export');
|
---|
2 | var ReflectMetadataModule = require('../internals/reflect-metadata');
|
---|
3 | var anObject = require('../internals/an-object');
|
---|
4 | var getPrototypeOf = require('../internals/object-get-prototype-of');
|
---|
5 |
|
---|
6 | var ordinaryHasOwnMetadata = ReflectMetadataModule.has;
|
---|
7 | var toMetadataKey = ReflectMetadataModule.toKey;
|
---|
8 |
|
---|
9 | var ordinaryHasMetadata = function (MetadataKey, O, P) {
|
---|
10 | var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P);
|
---|
11 | if (hasOwn) return true;
|
---|
12 | var parent = getPrototypeOf(O);
|
---|
13 | return parent !== null ? ordinaryHasMetadata(MetadataKey, parent, P) : false;
|
---|
14 | };
|
---|
15 |
|
---|
16 | // `Reflect.hasMetadata` method
|
---|
17 | // https://github.com/rbuckton/reflect-metadata
|
---|
18 | $({ target: 'Reflect', stat: true }, {
|
---|
19 | hasMetadata: function hasMetadata(metadataKey, target /* , targetKey */) {
|
---|
20 | var targetKey = arguments.length < 3 ? undefined : toMetadataKey(arguments[2]);
|
---|
21 | return ordinaryHasMetadata(metadataKey, anObject(target), targetKey);
|
---|
22 | }
|
---|
23 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.