This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type FilterOperator = 'AND' | 'OR'; | |
type FiltersBy<T> = { | |
[K in keyof T]?: (value: T[K]) => boolean; | |
}; | |
/** | |
* Factory function that creates a specialized function to filter | |
* arrays, by validating all filters (AND operator), | |
* or validating just one of the filters (OR operator). | |
* @param operator Method to validate all filters: AND, OR |