From cd47e95c37ca9a5cb8044a7811f58d42750acb1a Mon Sep 17 00:00:00 2001 From: Marin Atanasov <8436925+tyxla@users.noreply.github.com> Date: Tue, 28 Jun 2022 11:17:02 +0300 Subject: [PATCH] Lodash: Refactor away from _.lowerCase() (#41982) --- .eslintrc.js | 1 + packages/components/src/mobile/link-picker/index.native.js | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 9d762d916837e..2ff4876df4702 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -99,6 +99,7 @@ module.exports = { 'isObjectLike', 'isUndefined', 'keys', + 'lowerCase', 'memoize', 'negate', 'noop', diff --git a/packages/components/src/mobile/link-picker/index.native.js b/packages/components/src/mobile/link-picker/index.native.js index 7e42881a72faf..bf61bcddaa615 100644 --- a/packages/components/src/mobile/link-picker/index.native.js +++ b/packages/components/src/mobile/link-picker/index.native.js @@ -3,7 +3,6 @@ */ import { SafeAreaView, TouchableOpacity, View } from 'react-native'; import Clipboard from '@react-native-clipboard/clipboard'; -import { lowerCase, startsWith } from 'lodash'; /** * WordPress dependencies @@ -26,7 +25,7 @@ import styles from './styles.scss'; export const createDirectEntry = ( value ) => { let type = 'URL'; - const protocol = lowerCase( getProtocol( value ) ) || ''; + const protocol = getProtocol( value )?.toLowerCase() || ''; if ( protocol.includes( 'mailto' ) ) { type = 'mailto'; @@ -36,7 +35,7 @@ export const createDirectEntry = ( value ) => { type = 'tel'; } - if ( startsWith( value, '#' ) ) { + if ( value?.startsWith( '#' ) ) { type = 'internal'; }