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
  c54f6c32_7c33_b742_3596_7fd430089201["convertUnderscoresToWhitespace()"]
  7df4d001_f01e_1e05_13ee_91edb05bf1f8["decode-arbitrary-value.ts"]
  c54f6c32_7c33_b742_3596_7fd430089201 -->|defined in| 7df4d001_f01e_1e05_13ee_91edb05bf1f8
  8e4634e2_7c1f_b6c1_18b2_bd8f97be3651["decodeArbitraryValue()"]
  8e4634e2_7c1f_b6c1_18b2_bd8f97be3651 -->|calls| c54f6c32_7c33_b742_3596_7fd430089201
  d07c9a91_e1f5_792b_d5fc_9e0b6aeb8601["recursivelyDecodeArbitraryValues()"]
  d07c9a91_e1f5_792b_d5fc_9e0b6aeb8601 -->|calls| c54f6c32_7c33_b742_3596_7fd430089201
  style c54f6c32_7c33_b742_3596_7fd430089201 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, defined in packages/tailwindcss/src/utils/decode-arbitrary-value.ts.
Where is convertUnderscoresToWhitespace() defined?
convertUnderscoresToWhitespace() is defined in packages/tailwindcss/src/utils/decode-arbitrary-value.ts at line 23.
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