fix(lib/modules/finders/filters): simplify exports type is object checks

This commit is contained in:
PalmDevs 2025-07-18 01:55:16 +07:00
parent 75b026a46c
commit 96121e31e0
No known key found for this signature in database
GPG key ID: 6FAE8F8677ACA8BA

View file

@ -98,7 +98,7 @@ export type ByProps = FilterGenerator<
*/
export const byProps = createFilterGenerator<Parameters<ByProps>>(
(props, _, exports) => {
if (typeof exports === 'object' || typeof exports === 'function') {
if (exports instanceof Object) {
for (const prop of props) {
if (prop in exports) continue
return false
@ -127,7 +127,7 @@ export type WithoutProps = FilterGenerator<
*/
export const withoutProps = createFilterGenerator<Parameters<WithoutProps>>(
(props, _, exports) => {
if (typeof exports === 'object' || typeof exports === 'function')
if (exports instanceof Object)
for (const prop of props) if (prop in exports) return false
return true
@ -152,7 +152,7 @@ export type BySingleProp = FilterGenerator<
*/
export const bySingleProp = createFilterGenerator<Parameters<BySingleProp>>(
([prop], _, exports) => {
if (typeof exports === 'object' && prop in exports) {
if (exports instanceof Object && prop in exports) {
let hasMultipleProperties = false
for (const _ in exports) {
if (hasMultipleProperties) return false