@goodnight-dev/utils
    Preparing search index...
    • Convert a string to snake_case. Words are lowercased and joined with single underscores. A word boundary is any of: a run of non-alphanumeric characters (dropped), a lower-or-digit followed by an uppercase letter (fooBar), or the tail of an acronym (XMLHttpxml_http). Word detection and casing are both Unicode-correct, not ASCII-only.

      This is the inverse of camelCase and additionally splits camelHumps, which is the usual reason to reach for it: snakeCase('fooBar') is 'foo_bar'.

      Parameters

      • value: string

        The string to convert.

      Returns string

      The snake_case string. An empty string is returned unchanged.

      snakeCase('hello world') // => 'hello_world'
      snakeCase('fooBar') // => 'foo_bar'
      snakeCase('XMLHttpRequest') // => 'xml_http_request'
      snakeCase('baz-qux') // => 'baz_qux'
      snakeCase('héllo wörld') // => 'héllo_wörld'