diegoholiveira / jsonlogic

Go Lang implementation of JsonLogic
MIT License
159 stars 48 forks source link

Less than operator returns true with strings instead of false #50

Closed GeorgeD19 closed 2 years ago

GeorgeD19 commented 2 years ago

To Reproduce

  1. Run the following code
package main

import (
    "bytes"
    "fmt"
    "strings"

    "github.com/diegoholiveira/jsonlogic/v3"
)

func main() {
    logic := strings.NewReader(`{"<": ["abc", 3]}`)
    data := strings.NewReader(`{}`)

    var result bytes.Buffer

    jsonlogic.Apply(logic, data, &result)

    fmt.Println(result.String())
}

Expected false

"abc" is not less than 3. Using the same logic / data here https://jsonlogic.com/play.html will return the expected result.

Screenshot 2022-02-25 at 12 31 12

Actual true

diegoholiveira commented 2 years ago

Fixed in 08d60112ba3e0e666682f677a0c43899284013a3