Hiyve Components - v1.0.0
    Preparing search index...
    • Sanitize a string for use in a filename.

      Lowercases the input, strips non-alphanumeric characters (except spaces), collapses whitespace to single underscores, trims leading/trailing underscores, and truncates to maxLen characters.

      Parameters

      • name: string

        Raw title or label to sanitize.

      • maxLen: number = 40

        Maximum length of the result (default 40).

      Returns string

      A filesystem-safe string, or an empty string if nothing remains.

      sanitizeFilename('My Awesome Note!!')   // 'my_awesome_note'
      sanitizeFilename(' Piano Scales #3 ') // 'piano_scales_3'