Skip to content

Commit

Permalink
improve comments for matchname
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Sep 14, 2021
1 parent 1b7c3d8 commit 251d52b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mapstructure.go
Expand Up @@ -260,7 +260,8 @@ type DecoderConfig struct {
TagName string

// MatchName is the function used to match the map key to the struct
// field name or tag. Defaults to `strings.EqualFold`.
// field name or tag. Defaults to `strings.EqualFold`. This can be used
// to implement case-sensitive tag values, support snake casing, etc.
MatchName func(mapKey, fieldName string) bool
}

Expand Down Expand Up @@ -1436,6 +1437,7 @@ func (d *Decoder) matchName(mapKey, fieldName string) bool {
if d.config.MatchName != nil {
return d.config.MatchName(mapKey, fieldName)
}

return strings.EqualFold(mapKey, fieldName)
}

Expand Down

0 comments on commit 251d52b

Please sign in to comment.