import { find , isArray , matchesProperty , PropertyPath } from 'lodash' ; export const deepFilter = < T extends object , K > ( value , childrenKey , predicate ) => { const recursive = ( result , value ) => { if ( isArray ( value ) ) { result . push ( ... value . filter ( predicate ) ) ; value . forEach ( ( item ) => { if ( item [ childrenKey ] ) { recursive ( result , item [ childrenKey ] as any ) ; } } ) ; } return ; } ; const result = [ ] ; recursive ( result , value ) ; return result ; } ;