path-rite

reversePath

Reverse the winding direction of a path (CW to CCW or vice versa).

reversePath(svgPath: string): string

svgPath — SVG path d-attribute string.

Returns — A new SVG path string with reversed winding direction.

// Flip winding for even-odd fill compatibility
const reversed = pathRite.reversePath("M 0 0 L 100 0 L 100 100 Z");