toKeyPath() — tailwindcss Function Reference
Architecture documentation for the toKeyPath() function in to-key-path.ts from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 16014564_86ad_a5a3_1531_579a4693b33c["toKeyPath()"] fe1ae328_7455_13dc_ecbe_a4e848ee9ea0["migratePreflight()"] fe1ae328_7455_13dc_ecbe_a4e848ee9ea0 -->|calls| 16014564_86ad_a5a3_1531_579a4693b33c a5e6dda1_40ba_a775_d007_2d6576a30911["createConverter()"] a5e6dda1_40ba_a775_d007_2d6576a30911 -->|calls| 16014564_86ad_a5a3_1531_579a4693b33c c11e076e_d776_4d2a_acbf_702c1e172792["createConverterCache()"] c11e076e_d776_4d2a_acbf_702c1e172792 -->|calls| 16014564_86ad_a5a3_1531_579a4693b33c 3b6a2079_7f12_42cd_ba9f_a57ecec4366d["buildPluginApi()"] 3b6a2079_7f12_42cd_ba9f_a57ecec4366d -->|calls| 16014564_86ad_a5a3_1531_579a4693b33c 67fcef46_defb_2c9b_ab9b_59ae912b91f5["createThemeFn()"] 67fcef46_defb_2c9b_ab9b_59ae912b91f5 -->|calls| 16014564_86ad_a5a3_1531_579a4693b33c 03b8d706_a876_a776_0056_186ced5d6067["segment()"] 16014564_86ad_a5a3_1531_579a4693b33c -->|calls| 03b8d706_a876_a776_0056_186ced5d6067 style 16014564_86ad_a5a3_1531_579a4693b33c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/tailwindcss/src/utils/to-key-path.ts lines 18–54
export function toKeyPath(path: string) {
let keypath: string[] = []
for (let part of segment(path, '.')) {
if (!part.includes('[')) {
keypath.push(part)
continue
}
let currentIndex = 0
while (true) {
let bracketL = part.indexOf('[', currentIndex)
let bracketR = part.indexOf(']', bracketL)
if (bracketL === -1 || bracketR === -1) {
break
}
// Add the part before the bracket as a key
if (bracketL > currentIndex) {
keypath.push(part.slice(currentIndex, bracketL))
}
// Add the part inside the bracket as a key
keypath.push(part.slice(bracketL + 1, bracketR))
currentIndex = bracketR + 1
}
// Add the part after the last bracket as a key
if (currentIndex <= part.length - 1) {
keypath.push(part.slice(currentIndex))
}
}
return keypath
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does toKeyPath() do?
toKeyPath() is a function in the tailwindcss codebase.
What does toKeyPath() call?
toKeyPath() calls 1 function(s): segment.
What calls toKeyPath()?
toKeyPath() is called by 5 function(s): buildPluginApi, createConverter, createConverterCache, createThemeFn, migratePreflight.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free