Skip to content

Commit

Permalink
Merge pull request #26810 from software-mansion-labs/ts-migration/Str…
Browse files Browse the repository at this point in the history
…ingUtils

[TS migration] Migrate 'StringUtils.js' lib to TypeScript
  • Loading branch information
pecanoro authored Sep 12, 2023
2 parents a2000cb + 762672b commit 52c54f4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
12 changes: 0 additions & 12 deletions src/libs/StringUtils.js

This file was deleted.

13 changes: 13 additions & 0 deletions src/libs/StringUtils.ts
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};

0 comments on commit 52c54f4

Please sign in to comment.