parser/metadecoders: Simplify nil check in Unmarshal

This commit is contained in:
Bjørn Erik Pedersen
2022-12-14 15:19:04 +01:00
parent e30d711c29
commit 2a81a49499
2 changed files with 14 additions and 13 deletions

View File

@@ -112,7 +112,7 @@ func (d Decoder) UnmarshalStringTo(data string, typ any) (any, error) {
// Unmarshal will unmarshall data in format f into an interface{}.
// This is what's needed for Hugo's /data handling.
func (d Decoder) Unmarshal(data []byte, f Format) (any, error) {
if data == nil || len(data) == 0 {
if len(data) == 0 {
switch f {
case CSV:
return make([][]string, 0), nil