Home / Function/ walk() — tailwindcss Function Reference

walk() — tailwindcss Function Reference

Architecture documentation for the walk() function in walk.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  fb009bc2_68d9_5c0f_7fa7_fa364488e50a["walk()"]
  200c8408_4d17_9364_423b_0ce2d40b1e09["walk.ts"]
  fb009bc2_68d9_5c0f_7fa7_fa364488e50a -->|defined in| 200c8408_4d17_9364_423b_0ce2d40b1e09
  729a086c_18ec_2750_83e5_bdd730f8fa5e["formatNodes()"]
  729a086c_18ec_2750_83e5_bdd730f8fa5e -->|calls| fb009bc2_68d9_5c0f_7fa7_fa364488e50a
  a0235ccd_65fd_a71a_fafb_d79570dbb04c["migrateAtLayerUtilities()"]
  a0235ccd_65fd_a71a_fafb_d79570dbb04c -->|calls| fb009bc2_68d9_5c0f_7fa7_fa364488e50a
  92a12a9f_b36d_4c66_d885_e04224081f21["sortBuckets()"]
  92a12a9f_b36d_4c66_d885_e04224081f21 -->|calls| fb009bc2_68d9_5c0f_7fa7_fa364488e50a
  2c2d9239_b049_29e5_d26a_fdb5e6893cee["split()"]
  2c2d9239_b049_29e5_d26a_fdb5e6893cee -->|calls| fb009bc2_68d9_5c0f_7fa7_fa364488e50a
  style fb009bc2_68d9_5c0f_7fa7_fa364488e50a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/@tailwindcss-upgrade/src/utils/walk.ts lines 18–37

export function walk<T>(
  rule: Walkable<T>,
  cb: (rule: T, idx: number, parent: Walkable<T>) => void | WalkAction,
): undefined | false {
  let result: undefined | false = undefined

  rule.each?.((node, idx) => {
    let action = cb(node, idx, rule) ?? WalkAction.Continue
    if (action === WalkAction.Stop) {
      result = false
      return result
    }
    if (action !== WalkAction.Skip) {
      result = walk(node as Walkable<T>, cb)
      return result
    }
  })

  return result
}

Subdomains

Frequently Asked Questions

What does walk() do?
walk() is a function in the tailwindcss codebase, defined in packages/@tailwindcss-upgrade/src/utils/walk.ts.
Where is walk() defined?
walk() is defined in packages/@tailwindcss-upgrade/src/utils/walk.ts at line 18.
What calls walk()?
walk() is called by 4 function(s): formatNodes, migrateAtLayerUtilities, sortBuckets, split.

Analyze Your Own Codebase

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

Try Supermodel Free