You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
761 B
17 lines
761 B
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])); |
|
} });
|
|
|