mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
37e267bef9
* Create simpleSearch and IconCell
20 lines
430 B
JavaScript
20 lines
430 B
JavaScript
import { filter, includes } from "lodash";
|
|
|
|
const simpleSearch = (searchQuery = "", dictionary) => {
|
|
const lowerSearchQuery = searchQuery.toLowerCase();
|
|
|
|
const filterResults = filter(dictionary, (item) => {
|
|
if (!item.name) {
|
|
return false;
|
|
}
|
|
|
|
const lowerItemName = item.name.toLowerCase();
|
|
|
|
return includes(lowerItemName, lowerSearchQuery);
|
|
});
|
|
|
|
return filterResults;
|
|
};
|
|
|
|
export default simpleSearch;
|