import type { MaybePromise } from '../../controls/types.js'; export const _syncIntersectWith = ( other: readonly U[] | ReadonlySet, equals: (value: T, otherValue: U) => boolean, ) => (value: T) => { for (const otherValue of other) { if (equals(value, otherValue)) return true; } return false; }; export const _asyncIntersectWith = ( other: readonly U[] | ReadonlySet, equals: (value: T, otherValue: U) => MaybePromise, ) => async (value: T) => { for (const otherValue of other) { if (await equals(value, otherValue)) return true; } return false; };