import { ILiquorTreeFilter , ILiquorTreeExistingNode } from 'liquor-tree' ; import { INode } from '../../Node/INode' ; import { convertExistingToNode } from './NodeTranslator' ; export type FilterPredicate = ( node : INode ) => boolean ; export class NodePredicateFilter implements ILiquorTreeFilter { public emptyText = '' ; constructor ( private readonly filterPredicate ) { if ( ! filterPredicate ) { throw new Error ( 'filterPredicate is undefined' ) ; } } public matcher ( query , node ) { return this . filterPredicate ( convertExistingToNode ( node ) ) ; } }