UNPKG

722 BJavaScriptView Raw
1'use strict';
2var uncurryThis = require('../internals/function-uncurry-this');
3var hasOwn = require('../internals/has-own-property');
4var toIndexedObject = require('../internals/to-indexed-object');
5var indexOf = require('../internals/array-includes').indexOf;
6var hiddenKeys = require('../internals/hidden-keys');
7
8var push = uncurryThis([].push);
9
10module.exports = function (object, names) {
11 var O = toIndexedObject(object);
12 var i = 0;
13 var result = [];
14 var key;
15 for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
16 // Don't enum bug & hidden keys
17 while (names.length > i) if (hasOwn(O, key = names[i++])) {
18 ~indexOf(result, key) || push(result, key);
19 }
20 return result;
21};