MCPcopy Create free account
hub / github.com/formkit/formkit / handleNegativeClasses

Function handleNegativeClasses

packages/core/src/classes.ts:78–96  ·  view source on GitHub ↗
(classList: Record<string, boolean>)

Source from the content-addressed store, hash-verified

76}
77
78function handleNegativeClasses(classList: Record<string, boolean>): Record<string, boolean> {
79 const removalToken = '$remove:'
80 let hasNegativeClassValue = false
81 const applicableClasses = Object.keys(classList).filter((className) => {
82 if (classList[className] && className.startsWith(removalToken)) {
83 hasNegativeClassValue = true
84 }
85 return classList[className]
86 })
87 if (applicableClasses.length > 1 && hasNegativeClassValue) {
88 const negativeClasses = applicableClasses.filter(className => className.startsWith(removalToken))
89 negativeClasses.map((negativeClass) => {
90 const targetClass = negativeClass.substring(removalToken.length)
91 classList[targetClass] = false
92 classList[negativeClass] = false
93 })
94 }
95 return classList
96}

Callers 1

generateClassListFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected