Skip to content

Commit 735d043

Browse files
committed
fix: minor code refactors
1 parent cfefbe1 commit 735d043

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

pkg/twmerge/class-utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func MakeGetClassGroupId(conf *TwMergeConfig) GetClassGroupIdfn {
2626
}
2727
}
2828

29-
if classMap.Validators != nil && len(classMap.Validators) > 0 {
29+
if len(classMap.Validators) > 0 {
3030
remainingClass := strings.Join(classParts[i:], string(conf.ClassSeparator))
3131

3232
for _, validator := range classMap.Validators {

pkg/twmerge/create-tailwind-merge_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,9 @@ func TestTailwindMerge(t *testing.T) {
528528
got := Merge(tc.in)
529529
if areStringsEqual(got, tc.out) == false {
530530
t.Errorf("twMerge failed -> | in: %v | %v != %v", tc.in, got, tc.out)
531-
} else {
531+
} /* else {
532532
// t.Log("twMerge passed -> | in: ", tc.in, " | out: ", got, " | expected: ", tc.out)
533-
}
533+
} */
534534
}
535535
}
536536

pkg/twmerge/validators.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,12 @@ func IsNumber(val string) bool {
9696

9797
func IsInteger(val string) bool {
9898
_, err := strconv.Atoi(val)
99-
if err != nil {
100-
return false
101-
}
102-
return true
99+
return err == nil
103100
}
104101

105102
func IsFloat(val string) bool {
106103
_, err := strconv.ParseFloat(val, 64)
107-
if err != nil {
108-
return false
109-
}
110-
return true
104+
return err == nil
111105
}
112106

113107
func IsLengthOnly(val string) bool {

0 commit comments

Comments
 (0)