Skip to content

Commit

Permalink
Revert "feat(headless): add GetActionDataWithDefault generic func"
Browse files Browse the repository at this point in the history
This reverts commit fa12e0d.
  • Loading branch information
dwisiswant0 committed Aug 23, 2024
1 parent 99d191f commit 84e8573
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions pkg/protocols/headless/engine/action_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,15 +228,3 @@ func (holder *ActionTypeHolder) MarshalJSON() ([]byte, error) {
func (holder ActionTypeHolder) MarshalYAML() (interface{}, error) {
return holder.ActionType.String(), nil
}

// GetActionDataWithDefault gets the value associated with the given key from
// the [ActionData]. If the value cannot be asserted to the specified type T or
// the key does NOT exist, returns the provided default (def) value.
func GetActionDataWithDefault[T any](data ActionData, key string, def T) T {
v, ok := data[key].(T)
if !ok {
v = def
}

return v
}

0 comments on commit 84e8573

Please sign in to comment.