diff --git a/lib/modules/src/finders/filters.ts b/lib/modules/src/finders/filters.ts index 00bd7d3..810b87f 100644 --- a/lib/modules/src/finders/filters.ts +++ b/lib/modules/src/finders/filters.ts @@ -81,6 +81,23 @@ export const byProps = createFilterGenerator>( props => `revenge.props(${props.join(',')})`, ) as ByProps +export type WithoutProps = , K extends string>( + prop: K, + ...props: K[] +) => Filter, true> + +/** + * Filter modules by their exports having none of the specified properties. + * + * @param prop The property to check for. + * @param props More properties to check for (optional). + */ +export const withoutProps = createFilterGenerator>( + (props, _, exports) => + (typeof exports === 'object' || typeof exports === 'function') && !props.some(prop => prop in exports), + props => `revenge.withoutProps(${props.join(',')})`, +) as WithoutProps + export type ByName = ( name: T extends string ? T : T extends { name: string } ? T['name'] : string, ) => Filter