@rvoh/dream
    Preparing search index...

    Function normalizeUnicode

    • Normalizes a Unicode string according to the application's configured normalization form.

      Unicode normalization ensures text consistency by converting characters to a canonical representation. This is crucial for text comparison, searching, and data integrity, as the same visual text can be represented differently in Unicode (e.g., é as a single character vs. e + combining accent).

      The normalization form is configured via psy.set('unicodeNormalization', form) in app/conf.ts. The default form is 'NFC'. All strings and string arrays passed into Dream models are automatically normalized before database storage (values in JSON/JSONB fields are not automatically normalized). String values in queries (e.g., where, and) are automatically normalized to ensure search consistency.

      Parameters

      • val: string

        The string to normalize

      Returns string

      The normalized string, or the original string if normalization is disabled ('none')

      // With NFC normalization (default)
      normalizeUnicode('café') // Returns normalized form of café

      // With normalization disabled
      psy.set('unicodeNormalization', 'none')
      normalizeUnicode('café') // Returns original string unchanged