From afad1d6f220391203cbb3b2609a3ac5397b3b311 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Thu, 20 Apr 2023 15:08:13 +0100 Subject: [PATCH] replace omitby --- assets/js/icons/stories/index.tsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/assets/js/icons/stories/index.tsx b/assets/js/icons/stories/index.tsx index 2b0962776fc..9f28f36a212 100644 --- a/assets/js/icons/stories/index.tsx +++ b/assets/js/icons/stories/index.tsx @@ -1,7 +1,6 @@ /** * External dependencies */ -import { omitBy } from 'lodash'; import type { Story } from '@storybook/react'; import { useState } from '@wordpress/element'; import { Icon } from '@wordpress/icons'; @@ -14,9 +13,16 @@ const { ...availableIcons } = icons; export const Library: Story = ( args ) => { const [ filter, setFilter ] = useState( '' ); - const filteredIcons = omitBy( availableIcons, ( _, name ) => { - return ! name.includes( filter ); - } ); + + const filteredIcons = Object.entries( availableIcons ).reduce( + ( acc: Record< string, unknown >, [ name, icon ] ) => { + if ( name.includes( filter ) ) { + acc[ name ] = icon; + } + return acc; + }, + {} as Partial< typeof availableIcons > + ); return (