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.
21 lines
708 B
21 lines
708 B
2 years ago
|
var uncurryThis = require('../internals/function-uncurry-this');
|
||
|
var hasOwn = require('../internals/has-own-property');
|
||
|
var toIndexedObject = require('../internals/to-indexed-object');
|
||
|
var indexOf = require('../internals/array-includes').indexOf;
|
||
|
var hiddenKeys = require('../internals/hidden-keys');
|
||
|
|
||
|
var push = uncurryThis([].push);
|
||
|
|
||
|
module.exports = function (object, names) {
|
||
|
var O = toIndexedObject(object);
|
||
|
var i = 0;
|
||
|
var result = [];
|
||
|
var key;
|
||
|
for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
|
||
|
// Don't enum bug & hidden keys
|
||
|
while (names.length > i) if (hasOwn(O, key = names[i++])) {
|
||
|
~indexOf(result, key) || push(result, key);
|
||
|
}
|
||
|
return result;
|
||
|
};
|