export default function filterObject(object, predicate) {
	const result = {};
	const isArray = Array.isArray(predicate);

	for (const [key, value] of Object.entries(object)) {
		if (isArray ? predicate.includes(key) : predicate(key, value, object)) {
			Object.defineProperty(result, key, {
				value,
				writable: true,
				enumerable: true,
				configurable: true,
			});
		}
	}

	return result;
}

@@ -75,25 +75,14 @@
 %7B%7D;%0A
-%09const isArray = 
+%0A%09if (
 Arra
@@ -101,19 +101,55 @@
 edicate)
-;%0A%0A
+) %7B%0A%09%09const set = new Set(predicate);%0A%09
 %09for (co
@@ -156,20 +156,11 @@
 nst 
-%5B
 key
-, value%5D
  of 
@@ -170,14 +170,11 @@
 ect.
-entrie
+key
 s(ob
@@ -186,50 +186,273 @@
 ) %7B%0A
+%09
 %09%09if (
-isArray ? predicate.includes(key) : 
+set.has(key)) %7B%0A%09%09%09%09const value = object%5Bkey%5D;%0A%09%09%09%09Object.defineProperty(result, key, %7B%0A%09%09%09%09%09value,%0A%09%09%09%09%09writable: true,%0A%09%09%09%09%09enumerable: true,%0A%09%09%09%09%09configurable: true,%0A%09%09%09%09%7D);%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D else %7B%0A%09%09for (const %5Bkey, value%5D of Object.entries(object)) %7B%0A%09%09%09if (
 pred
@@ -480,16 +480,17 @@
 ect)) %7B%0A
+%09
 %09%09%09Objec
@@ -521,31 +521,33 @@
  key, %7B%0A%09%09%09%09
+%09
 value,%0A
+%09
 %09%09%09%09writable
@@ -550,24 +550,25 @@
 able: true,%0A
+%09
 %09%09%09%09enumerab
@@ -577,24 +577,25 @@
 : true,%0A%09%09%09%09
+%09
 configurable
@@ -602,23 +602,29 @@
 : true,%0A
+%09
 %09%09%09%7D);%0A
+%09%09%09%7D%0A
 %09%09%7D%0A%09%7D%0A%0A

Improve performance of array predicates (#15)