2017-08-14 05:01:11 +02:00
|
|
|
var metadata = require('./_metadata');
|
|
|
|
var anObject = require('./_an-object');
|
|
|
|
var getPrototypeOf = require('./_object-gpo');
|
|
|
|
var ordinaryHasOwnMetadata = metadata.has;
|
|
|
|
var ordinaryGetOwnMetadata = metadata.get;
|
|
|
|
var toMetaKey = metadata.key;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
var ordinaryGetMetadata = function (MetadataKey, O, P) {
|
2017-05-28 00:38:50 +02:00
|
|
|
var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P);
|
2017-08-14 05:01:11 +02:00
|
|
|
if (hasOwn) return ordinaryGetOwnMetadata(MetadataKey, O, P);
|
2017-05-28 00:38:50 +02:00
|
|
|
var parent = getPrototypeOf(O);
|
|
|
|
return parent !== null ? ordinaryGetMetadata(MetadataKey, parent, P) : undefined;
|
|
|
|
};
|
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
metadata.exp({ getMetadata: function getMetadata(metadataKey, target /* , targetKey */) {
|
2017-05-28 00:38:50 +02:00
|
|
|
return ordinaryGetMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
|
2017-08-14 05:01:11 +02:00
|
|
|
} });
|