fix: reset postfix modifier position if invalid #14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reset postfix modifier position if invalid
Description
This PR adds a missing else clause that ensures the postfix modifier position is properly reset when invalid, bringing the behavior in line with the original repository's implementation. The change fixes an issue where invalid positions weren't being reset to -1, which could lead to index out of bounds errors in certain cases, as demonstrated by the newly added test cases.
https://github.com/dcastil/tailwind-merge/blob/a8b2a84568a50aa01e97d2602f6ed9d9c14fe634/src/lib/parse-class-name.ts#L54C1-L57C28