-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26810 from software-mansion-labs/ts-migration/Str…
…ingUtils [TS migration] Migrate 'StringUtils.js' lib to TypeScript
- Loading branch information
Showing
2 changed files
with
13 additions
and
12 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import _ from 'lodash'; | ||
import CONST from '../CONST'; | ||
|
||
/** | ||
* Removes diacritical marks and non-alphabetic and non-latin characters from a string. | ||
* @param str - The input string to be sanitized. | ||
* @returns The sanitized string | ||
*/ | ||
function sanitizeString(str: string): string { | ||
return _.deburr(str).toLowerCase().replaceAll(CONST.REGEX.NON_ALPHABETIC_AND_NON_LATIN_CHARS, ''); | ||
} | ||
|
||
export default {sanitizeString}; |