Home / Function/ recursivelyDecodeArbitraryValues() — tailwindcss Function Reference

recursivelyDecodeArbitraryValues() — tailwindcss Function Reference

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

Function typescript OxideEngine Scanner calls 2 called by 1

Entity Profile

Dependency Diagram

graph TD
  a409a820_0c6d_1955_f58f_c67b20671bd8["recursivelyDecodeArbitraryValues()"]
  e90d9c51_31f0_3175_a861_610a15e277e5["decode-arbitrary-value.ts"]
  a409a820_0c6d_1955_f58f_c67b20671bd8 -->|defined in| e90d9c51_31f0_3175_a861_610a15e277e5
  2e1adb5d_9a16_16d9_9e0d_e7ef80a3ec69["decodeArbitraryValue()"]
  2e1adb5d_9a16_16d9_9e0d_e7ef80a3ec69 -->|calls| a409a820_0c6d_1955_f58f_c67b20671bd8
  ba41d638_0148_998b_cafb_fbd5a10ecee9["convertUnderscoresToWhitespace()"]
  a409a820_0c6d_1955_f58f_c67b20671bd8 -->|calls| ba41d638_0148_998b_cafb_fbd5a10ecee9
  550e864b_848d_0e80_df36_f9369ce68354["never()"]
  a409a820_0c6d_1955_f58f_c67b20671bd8 -->|calls| 550e864b_848d_0e80_df36_f9369ce68354
  style a409a820_0c6d_1955_f58f_c67b20671bd8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/utils/decode-arbitrary-value.ts lines 48–89

function recursivelyDecodeArbitraryValues(ast: ValueParser.ValueAstNode[]) {
  for (let node of ast) {
    switch (node.kind) {
      case 'function': {
        if (node.value === 'url' || node.value.endsWith('_url')) {
          // Don't decode underscores in url() but do decode the function name
          node.value = convertUnderscoresToWhitespace(node.value)
          break
        }

        if (
          node.value === 'var' ||
          node.value.endsWith('_var') ||
          node.value === 'theme' ||
          node.value.endsWith('_theme')
        ) {
          node.value = convertUnderscoresToWhitespace(node.value)
          for (let i = 0; i < node.nodes.length; i++) {
            // Don't decode underscores to spaces in the first argument of var()
            if (i == 0 && node.nodes[i].kind === 'word') {
              node.nodes[i].value = convertUnderscoresToWhitespace(node.nodes[i].value, true)
              continue
            }
            recursivelyDecodeArbitraryValues([node.nodes[i]])
          }
          break
        }

        node.value = convertUnderscoresToWhitespace(node.value)
        recursivelyDecodeArbitraryValues(node.nodes)
        break
      }
      case 'separator':
      case 'word': {
        node.value = convertUnderscoresToWhitespace(node.value)
        break
      }
      default:
        never(node)
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does recursivelyDecodeArbitraryValues() do?
recursivelyDecodeArbitraryValues() is a function in the tailwindcss codebase, defined in packages/tailwindcss/src/utils/decode-arbitrary-value.ts.
Where is recursivelyDecodeArbitraryValues() defined?
recursivelyDecodeArbitraryValues() is defined in packages/tailwindcss/src/utils/decode-arbitrary-value.ts at line 48.
What does recursivelyDecodeArbitraryValues() call?
recursivelyDecodeArbitraryValues() calls 2 function(s): convertUnderscoresToWhitespace, never.
What calls recursivelyDecodeArbitraryValues()?
recursivelyDecodeArbitraryValues() is called by 1 function(s): decodeArbitraryValue.

Analyze Your Own Codebase

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

Try Supermodel Free