Skip to content

Commit

Permalink
[TS migration] Migrate 'StringUtils.js' lib to TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
blazejkustra committed Sep 5, 2023
1 parent 6b1a667 commit 762672b
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 762672b

Please sign in to comment.