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
  ba41d638_0148_998b_cafb_fbd5a10ecee9["convertUnderscoresToWhitespace()"]
  e90d9c51_31f0_3175_a861_610a15e277e5["decode-arbitrary-value.ts"]
  ba41d638_0148_998b_cafb_fbd5a10ecee9 -->|defined in| e90d9c51_31f0_3175_a861_610a15e277e5
  2e1adb5d_9a16_16d9_9e0d_e7ef80a3ec69["decodeArbitraryValue()"]
  2e1adb5d_9a16_16d9_9e0d_e7ef80a3ec69 -->|calls| ba41d638_0148_998b_cafb_fbd5a10ecee9
  a409a820_0c6d_1955_f58f_c67b20671bd8["recursivelyDecodeArbitraryValues()"]
  a409a820_0c6d_1955_f58f_c67b20671bd8 -->|calls| ba41d638_0148_998b_cafb_fbd5a10ecee9
  style ba41d638_0148_998b_cafb_fbd5a10ecee9 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