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 f1189154_e89f_8988_3e83_53458fbcad21["toKeyPath()"] a3f66598_fbf6_c4e3_9350_55626482e7b1["migratePreflight()"] a3f66598_fbf6_c4e3_9350_55626482e7b1 -->|calls| f1189154_e89f_8988_3e83_53458fbcad21 da84d4b5_fc28_e826_1855_2340e6df074e["createConverter()"] da84d4b5_fc28_e826_1855_2340e6df074e -->|calls| f1189154_e89f_8988_3e83_53458fbcad21 3a7318a6_ec18_9d9c_0667_804b7d2f542d["createConverterCache()"] 3a7318a6_ec18_9d9c_0667_804b7d2f542d -->|calls| f1189154_e89f_8988_3e83_53458fbcad21 ad196438_55f7_af7b_1604_1d75c1c27d8e["buildPluginApi()"] ad196438_55f7_af7b_1604_1d75c1c27d8e -->|calls| f1189154_e89f_8988_3e83_53458fbcad21 1ea8fd4a_634f_c2f0_5465_01d387d5207b["createThemeFn()"] 1ea8fd4a_634f_c2f0_5465_01d387d5207b -->|calls| f1189154_e89f_8988_3e83_53458fbcad21 2a20ea29_c850_cd61_5600_aeebbe3dda66["segment()"] f1189154_e89f_8988_3e83_53458fbcad21 -->|calls| 2a20ea29_c850_cd61_5600_aeebbe3dda66 style f1189154_e89f_8988_3e83_53458fbcad21 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