From e86e80112235ad43214e37244a403e90a573c9d4 Mon Sep 17 00:00:00 2001 From: Marin Atanasov <8436925+tyxla@users.noreply.github.com> Date: Tue, 28 Jun 2022 11:15:31 +0300 Subject: [PATCH] Lodash: Remove completely from icons package (#41971) --- packages/icons/src/icon/stories/index.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/packages/icons/src/icon/stories/index.js b/packages/icons/src/icon/stories/index.js index 9d1b2d427809c..1cb4f2f4901b1 100644 --- a/packages/icons/src/icon/stories/index.js +++ b/packages/icons/src/icon/stories/index.js @@ -1,8 +1,3 @@ -/** - * External dependencies - */ -import { omit, omitBy, map } from 'lodash'; - /** * WordPress dependencies */ @@ -15,7 +10,7 @@ import Icon from '../'; import check from '../../library/check'; import * as icons from '../../'; -const availableIcons = omit( icons, 'Icon' ); +const { Icon: _Icon, ...availableIcons } = icons; export default { title: 'Icons/Icon', component: Icon }; @@ -42,9 +37,13 @@ export const _default = () => { const LibraryExample = () => { const [ filter, setFilter ] = useState( '' ); - const filteredIcons = omitBy( availableIcons, ( _icon, name ) => { - return name.indexOf( filter ) === -1; - } ); + const filteredIcons = filter.length + ? Object.fromEntries( + Object.entries( availableIcons ).filter( ( [ name ] ) => + name.includes( filter ) + ) + ) + : availableIcons; return (