Skip to content

Commit

Permalink
Mark ApplyInterface as public method
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoholiveira committed Jan 5, 2025
1 parent 659feac commit c321e8c
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 172 deletions.
133 changes: 0 additions & 133 deletions helpers_test.go

This file was deleted.

8 changes: 4 additions & 4 deletions jsonlogic.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ func Apply(rule, data io.Reader, result io.Writer) error {
return err
}

output, err := applyInterface(_rule, _data)
output, err := ApplyInterface(_rule, _data)
if err != nil {
return err
}
Expand Down Expand Up @@ -561,17 +561,17 @@ func ApplyRaw(rule, data json.RawMessage) (json.RawMessage, error) {
return nil, err
}

result, err := applyInterface(_rule, _data)
result, err := ApplyInterface(_rule, _data)
if err != nil {
return nil, err
}

return json.Marshal(&result)
}

// applyInterface receives a rule and data as interface{} and returns the result
// ApplyInterface receives a rule and data as interface{} and returns the result
// of the rule applied to the data.
func applyInterface(rule, data interface{}) (output interface{}, err error) {
func ApplyInterface(rule, data interface{}) (output interface{}, err error) {
defer func() {
if e := recover(); e != nil {
// fmt.Println("stacktrace from panic: \n" + string(debug.Stack()))
Expand Down
Loading

0 comments on commit c321e8c

Please sign in to comment.