massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / core-js / modules / esnext.reflect.get-metadata-keys.js
1 var $ = require('../internals/export');
2 var uncurryThis = require('../internals/function-uncurry-this');
3 var ReflectMetadataModule = require('../internals/reflect-metadata');
4 var anObject = require('../internals/an-object');
5 var getPrototypeOf = require('../internals/object-get-prototype-of');
6 var $arrayUniqueBy = require('../internals/array-unique-by');
7
8 var arrayUniqueBy = uncurryThis($arrayUniqueBy);
9 var concat = uncurryThis([].concat);
10 var ordinaryOwnMetadataKeys = ReflectMetadataModule.keys;
11 var toMetadataKey = ReflectMetadataModule.toKey;
12
13 var ordinaryMetadataKeys = function (O, P) {
14   var oKeys = ordinaryOwnMetadataKeys(O, P);
15   var parent = getPrototypeOf(O);
16   if (parent === null) return oKeys;
17   var pKeys = ordinaryMetadataKeys(parent, P);
18   return pKeys.length ? oKeys.length ? arrayUniqueBy(concat(oKeys, pKeys)) : pKeys : oKeys;
19 };
20
21 // `Reflect.getMetadataKeys` method
22 // https://github.com/rbuckton/reflect-metadata
23 $({ target: 'Reflect', stat: true }, {
24   getMetadataKeys: function getMetadataKeys(target /* , targetKey */) {
25     var targetKey = arguments.length < 2 ? undefined : toMetadataKey(arguments[1]);
26     return ordinaryMetadataKeys(anObject(target), targetKey);
27   }
28 });