Home / Function/ convertUnderscoresToWhitespace() — tailwindcss Function Reference

convertUnderscoresToWhitespace() — tailwindcss Function Reference

Architecture documentation for the convertUnderscoresToWhitespace() function in decode-arbitrary-value.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  17722c69_83eb_3eca_a126_826c54cdd9cf["convertUnderscoresToWhitespace()"]
  fcaea65f_8651_c21e_ec5d_f042e1ab495e["decodeArbitraryValue()"]
  fcaea65f_8651_c21e_ec5d_f042e1ab495e -->|calls| 17722c69_83eb_3eca_a126_826c54cdd9cf
  5666e99d_13d5_2782_fe94_78f3f4fb3234["recursivelyDecodeArbitraryValues()"]
  5666e99d_13d5_2782_fe94_78f3f4fb3234 -->|calls| 17722c69_83eb_3eca_a126_826c54cdd9cf
  style 17722c69_83eb_3eca_a126_826c54cdd9cf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/utils/decode-arbitrary-value.ts lines 23–46

function convertUnderscoresToWhitespace(input: string, skipUnderscoreToSpace = false) {
  let output = ''
  for (let i = 0; i < input.length; i++) {
    let char = input[i]

    // Escaped underscore
    if (char === '\\' && input[i + 1] === '_') {
      output += '_'
      i += 1
    }

    // Unescaped underscore
    else if (char === '_' && !skipUnderscoreToSpace) {
      output += ' '
    }

    // All other characters
    else {
      output += char
    }
  }

  return output
}

Domain

Subdomains

Frequently Asked Questions

What does convertUnderscoresToWhitespace() do?
convertUnderscoresToWhitespace() is a function in the tailwindcss codebase.
What calls convertUnderscoresToWhitespace()?
convertUnderscoresToWhitespace() is called by 2 function(s): decodeArbitraryValue, recursivelyDecodeArbitraryValues.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free