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.
20 lines
783 B
JavaScript
20 lines
783 B
JavaScript
6 years ago
|
var Set = require('./es6.set');
|
||
|
var from = require('./_array-from-iterable');
|
||
|
var metadata = require('./_metadata');
|
||
|
var anObject = require('./_an-object');
|
||
|
var getPrototypeOf = require('./_object-gpo');
|
||
|
var ordinaryOwnMetadataKeys = metadata.keys;
|
||
|
var toMetaKey = metadata.key;
|
||
|
|
||
|
var ordinaryMetadataKeys = function (O, P) {
|
||
|
var oKeys = ordinaryOwnMetadataKeys(O, P);
|
||
|
var parent = getPrototypeOf(O);
|
||
|
if (parent === null) return oKeys;
|
||
|
var pKeys = ordinaryMetadataKeys(parent, P);
|
||
|
return pKeys.length ? oKeys.length ? from(new Set(oKeys.concat(pKeys))) : pKeys : oKeys;
|
||
|
};
|
||
|
|
||
|
metadata.exp({ getMetadataKeys: function getMetadataKeys(target /* , targetKey */) {
|
||
|
return ordinaryMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1]));
|
||
|
} });
|