import { IColumn } from 'office-ui-fabric-react/lib/DetailsList' ; import { getObjectValue as get } from 'pp365-shared/lib/helpers' ; param item param searchTerm param columns export const filterItem = ( item , searchTerm , columns ) => { searchTerm = searchTerm . toLowerCase ( ) ; const searchObj = columns . reduce ( ( obj , col ) => { return { ... obj , [ col . fieldName ] : get ( item , col . fieldName , null ) } ; } , { } ) ; return JSON . stringify ( searchObj ) . toLowerCase ( ) . indexOf ( searchTerm ) !== - 1 ; } ;