Skip to content

Commit

Permalink
Lodash: Refactor away from _.deburr() (#43118)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla authored Aug 12, 2022
1 parent 3ec3f09 commit 7848b73
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ module.exports = {
'compact',
'concat',
'countBy',
'deburr',
'defaults',
'defaultTo',
'delay',
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"lodash": "^4.17.21",
"memize": "^1.1.0",
"rememo": "^4.0.0",
"remove-accents": "^0.4.2",
"showdown": "^1.9.1",
"simple-html-tokenizer": "^0.5.7",
"uuid": "^8.3.0"
Expand Down
5 changes: 3 additions & 2 deletions packages/blocks/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* External dependencies
*/
import createSelector from 'rememo';
import { deburr, filter, flow, get, includes, map, some } from 'lodash';
import removeAccents from 'remove-accents';
import { filter, flow, get, includes, map, some } from 'lodash';

/** @typedef {import('../api/registration').WPBlockVariation} WPBlockVariation */
/** @typedef {import('../api/registration').WPBlockVariationScope} WPBlockVariationScope */
Expand Down Expand Up @@ -688,7 +689,7 @@ export function isMatchingSearchTerm( state, nameOrType, searchTerm ) {
const getNormalizedSearchTerm = flow( [
// Disregard diacritics.
// Input: "média"
deburr,
( term ) => removeAccents( term ?? '' ),

// Lowercase.
// Input: "MEDIA"
Expand Down

0 comments on commit 7848b73

Please sign in to comment.