File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
packages/tailwindcss/src/utils Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change 1+ /* Supports up to 256 levels of nesting. This should be more than enough for any reasonable usage */
2+ const closingBracketStack = new Uint8Array ( 256 )
3+ const OPEN_PAREN = '(' . charCodeAt ( 0 )
4+ const OPEN_BRACKET = '[' . charCodeAt ( 0 )
5+ const OPEN_BRACE = '{' . charCodeAt ( 0 )
6+ const CLOSE_PAREN = ')' . charCodeAt ( 0 )
7+ const CLOSE_BRACKET = ']' . charCodeAt ( 0 )
8+ const CLOSE_BRACE = '}' . charCodeAt ( 0 )
9+ const BACKSLASH = '\\' . charCodeAt ( 0 )
10+
111/**
212 * This splits a string on a top-level character.
313 *
1020 * x x x ╰──────── Split because top-level
1121 * ╰──────────────┴──┴───────────── Ignored b/c inside >= 1 levels of parens
1222 */
13- const closingBracketStack = new Uint8Array ( 256 )
14- const OPEN_PAREN = '(' . charCodeAt ( 0 )
15- const OPEN_BRACKET = '[' . charCodeAt ( 0 )
16- const OPEN_BRACE = '{' . charCodeAt ( 0 )
17- const CLOSE_PAREN = ')' . charCodeAt ( 0 )
18- const CLOSE_BRACKET = ']' . charCodeAt ( 0 )
19- const CLOSE_BRACE = '}' . charCodeAt ( 0 )
20- const BACKSLASH = '\\' . charCodeAt ( 0 )
21-
2223export function segment ( input : string , separator : string ) {
2324 // Since JavaScript is single-threaded, using a shared buffer
2425 // is more efficient and should still be safe.
You can’t perform that action at this time.
0 commit comments