mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-18 16:15:26 +00:00
* Fixing directory walk error check on windows * moving check to helper package * replacing godirwalk with standard library
40 lines
717 B
Go
40 lines
717 B
Go
package compare
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
// StringSlice compares two string slices for equality
|
|
func StringSlice(a, b []string) bool {
|
|
// If one is nil, the other must also be nil.
|
|
if (a == nil) != (b == nil) {
|
|
return false
|
|
}
|
|
if len(a) != len(b) {
|
|
return false
|
|
}
|
|
for i := range a {
|
|
if !strings.EqualFold(a[i], b[i]) {
|
|
return false
|
|
}
|
|
}
|
|
return true
|
|
}
|
|
|
|
// StringMap compares two string maps for equality
|
|
func StringMap(a, b map[string]string) bool {
|
|
// If one is nil, the other must also be nil.
|
|
if (a == nil) != (b == nil) {
|
|
return false
|
|
}
|
|
if len(a) != len(b) {
|
|
return false
|
|
}
|
|
for k, v := range a {
|
|
if w, ok := b[k]; !ok || !strings.EqualFold(v, w) {
|
|
return false
|
|
}
|
|
}
|
|
return true
|
|
}
|