MCPcopy Create free account
hub / github.com/donghaxkim/react-rewrite / updateClassString

Function updateClassString

packages/cli/src/transform.ts:355–364  ·  view source on GitHub ↗

* Apply updates to a class string (space-separated list of classes).

(
  classStr: string,
  updates: ClassNameUpdate[]
)

Source from the content-addressed store, hash-verified

353 * Apply updates to a class string (space-separated list of classes).
354 */
355function updateClassString(
356 classStr: string,
357 updates: ClassNameUpdate[]
358): string {
359 let classes = classStr.split(/\s+/).filter(Boolean);
360 for (const update of updates) {
361 classes = applyUpdate(classes, update);
362 }
363 return classes.join(" ");
364}
365
366/**
367 * Check if a cn()/clsx() call has the prefix in a conditional argument.

Callers 1

mutateClassNameFunction · 0.85

Calls 1

applyUpdateFunction · 0.85

Tested by

no test coverage detected