MCPcopy
hub / github.com/tailwindlabs/tailwindcss / findNode

Function findNode

packages/tailwindcss/src/ast.ts:892–902  ·  view source on GitHub ↗
(ast: AstNode[], fn: (node: AstNode) => boolean)

Source from the content-addressed store, hash-verified

890}
891
892function findNode(ast: AstNode[], fn: (node: AstNode) => boolean): AstNode[] | null {
893 let foundPath: AstNode[] = []
894 walk(ast, (node, ctx) => {
895 if (fn(node)) {
896 foundPath = ctx.path()
897 foundPath.push(node)
898 return WalkAction.Stop
899 }
900 })
901 return foundPath
902}
903
904// Find out if a variable is either used directly or if any of the variables that depend on it are
905// used

Callers 1

optimizeAstFunction · 0.85

Calls 1

walkFunction · 0.90

Tested by

no test coverage detected