You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
761 B
JavaScript
18 lines
761 B
JavaScript
5 years ago
|
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;
|
||
|
|
||
|
var ordinaryGetMetadata = function (MetadataKey, O, P) {
|
||
|
var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P);
|
||
|
if (hasOwn) return ordinaryGetOwnMetadata(MetadataKey, O, P);
|
||
|
var parent = getPrototypeOf(O);
|
||
|
return parent !== null ? ordinaryGetMetadata(MetadataKey, parent, P) : undefined;
|
||
|
};
|
||
|
|
||
|
metadata.exp({ getMetadata: function getMetadata(metadataKey, target /* , targetKey */) {
|
||
|
return ordinaryGetMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
|
||
|
} });
|