"Fossies" - the Fresh Open Source Software Archive

Member "jitsi-meet-7316/react/features/base/util/strings.native.ts" (5 Jun 2023, 773 Bytes) of package /linux/misc/jitsi-meet-7316.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 import * as unorm from 'unorm';
    2 
    3 /**
    4  * Applies NFKC normalization to the given text.
    5  * NOTE: Here we use the unorm package because the JSC version in React Native for Android crashes.
    6  *
    7  * @param {string} text - The text that needs to be normalized.
    8  * @returns {string} - The normalized text.
    9  */
   10 export function normalizeNFKC(text: string) {
   11     return unorm.nfkc(text);
   12 }
   13 
   14 /**
   15  * Replaces accent characters with english alphabet characters.
   16  * NOTE: Here we use the unorm package because the JSC version in React Native for Android crashes.
   17  *
   18  * @param {string} text - The text that needs to be normalized.
   19  * @returns {string} - The normalized text.
   20  */
   21 export function normalizeAccents(text: string) {
   22     return unorm.nfd(text).replace(/[\u0300-\u036f]/g, '');
   23 }