import { get } from 'lodash' ; const sanatize = ( value ) => typeof value === 'string' ? value . normalize ( 'NFD' ) . replace ( /[\u0300-\u036f]/g , '' ) . toLowerCase ( ) : value ?. toString ( ) ; export function createSearchFunction ( fields , searchQuery ) { return ( obj ) => fields . some ( ( field ) => sanatize ( get ( obj , field ) || '' ) . includes ( sanatize ( searchQuery ) ) ) ; }