diff --git a/lib/like-selector.js b/lib/like-selector.js index ea8068977..ca27aaa95 100644 --- a/lib/like-selector.js +++ b/lib/like-selector.js @@ -1,9 +1,14 @@ export function isLikeSelector(selector) { - const prototype = Reflect.getPrototypeOf(selector); - return selector !== null - && typeof selector === 'object' - && (prototype === Object.prototype || prototype === Array.prototype) - && Reflect.ownKeys(selector).length > 0; + const isArrayOrObject = selector !== null && typeof selector === 'object'; + + if (!isArrayOrObject) { + return false; + } + + const isArray = Array.isArray(selector); + const minimumKeysRequired = isArray ? 1 : 0; + + return Reflect.ownKeys(selector).length > minimumKeysRequired; } export const CIRCULAR_SELECTOR = new Error('Encountered a circular selector');