From 62e9f4d5f077270e2da73115427e3844e2c5a050 Mon Sep 17 00:00:00 2001 From: Anoop M D Date: Tue, 11 Oct 2022 01:35:46 +0530 Subject: [PATCH] chore: added null safety while searching --- packages/bruno-app/src/utils/collections/search.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/bruno-app/src/utils/collections/search.js b/packages/bruno-app/src/utils/collections/search.js index 84e6ee30..c266cf6b 100644 --- a/packages/bruno-app/src/utils/collections/search.js +++ b/packages/bruno-app/src/utils/collections/search.js @@ -2,18 +2,18 @@ import { flattenItems, isItemARequest } from "./index"; import filter from 'lodash/filter'; import find from 'lodash/find'; -export const doesRequestMatchSearchText = (request, searchText) => { +export const doesRequestMatchSearchText = (request, searchText = '') => { return request.name.toLowerCase().includes(searchText.toLowerCase()); }; -export const doesFolderHaveItemsMatchSearchText = (item, searchText) => { +export const doesFolderHaveItemsMatchSearchText = (item, searchText = '') => { let flattenedItems = flattenItems(item.items); let requestItems = filter(flattenedItems, (item) => isItemARequest(item)); return find(requestItems, (request) => doesRequestMatchSearchText(request, searchText)); }; -export const doesCollectionHaveItemsMatchingSearchText = (collection, searchText) => { +export const doesCollectionHaveItemsMatchingSearchText = (collection, searchText = '') => { let flattenedItems = flattenItems(collection.items); let requestItems = filter(flattenedItems, (item) => isItemARequest(item));