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
  8a2e42cf_cbb8_4913_c2ad_33a2cbd2b313["convertUnderscoresToWhitespace()"]
  20489d8d_4ac1_6581_7ef8_8b43d79a6212["decodeArbitraryValue()"]
  20489d8d_4ac1_6581_7ef8_8b43d79a6212 -->|calls| 8a2e42cf_cbb8_4913_c2ad_33a2cbd2b313
  6835415c_08d3_78de_ebc3_29e921bf7043["recursivelyDecodeArbitraryValues()"]
  6835415c_08d3_78de_ebc3_29e921bf7043 -->|calls| 8a2e42cf_cbb8_4913_c2ad_33a2cbd2b313
  style 8a2e42cf_cbb8_4913_c2ad_33a2cbd2b313 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
}

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