Skip to content

Commit

Permalink
change to object
Browse files Browse the repository at this point in the history
  • Loading branch information
dcastil committed Jan 29, 2025
1 parent 5a0a737 commit 16de04e
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions src/lib/parse-class-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,19 @@ export const createParseClassName = (config: AnyConfig) => {
return parseClassName
}

const positionSensitiveModifiers = [
'before',
'after',
'placeholder',
'file',
'marker',
'selection',
'first-line',
'first-letter',
'backdrop',
'*',
'**',
]
const positionSensitiveModifiers: Record<string, boolean> = {
before: true,
after: true,
placeholder: true,
file: true,
marker: true,
selection: true,
'first-line': true,
'first-letter': true,
backdrop: true,
'*': true,
'**': true,
}

/**
* Sorts modifiers according to following schema:
Expand All @@ -122,8 +122,7 @@ export const sortModifiers = (modifiers: string[]) => {
let unsortedModifiers: string[] = []

modifiers.forEach((modifier) => {
const isPositionSensitive =
modifier[0] === '[' || positionSensitiveModifiers.includes(modifier)
const isPositionSensitive = modifier[0] === '[' || positionSensitiveModifiers[modifier]

if (isPositionSensitive) {
sortedModifiers.push(...unsortedModifiers.sort(), modifier)
Expand Down

0 comments on commit 16de04e

Please sign in to comment.