Repository: diegoholiveira/jsonlogic (go)

Issue:
filter body returns error when used with array-form var
Using the full `{"var": [...]}` syntax instead of the syntax sugar `{"var": "..."}` causes an error when present in a `filter` body. As an example, the following rule (adapted from the test suite) will fail:

```json
	{
		"filter": [
			{"var": ["people"]},
			{"==": [
				{"var": [".age"]},
				{"min": {"map": [
					{"var": ["people"]},
					{"var": [".age"]}
				]}}
			]}
		]
	}
```
with the data:
```json
	{
		"people": [
			{"age":18, "name":"John"},
			{"age":20, "name":"Luke"},
			{"age":18, "name":"Mark"}
		]
	}
```

I believe the cause is this line: https://github.com/diegoholiveira/jsonlogic/blob/master/vars.go#L15

Pull request description:
Ensure value is string before trying to convert it
closes #70 

Patch:
diff --git a/jsonlogic.go b/jsonlogic.go
index babe7f8..48a0320 100644
--- a/jsonlogic.go
+++ b/jsonlogic.go
@@ -6,6 +6,7 @@ import (
 	"io"
 	"sort"
 	"strings"
+	// "runtime/debug"
 
 	"github.com/mitchellh/copystructure"
 )
diff --git a/vars.go b/vars.go
index 46294d5..d619e6e 100644
--- a/vars.go
+++ b/vars.go
@@ -12,7 +12,7 @@ func solveVars(values, data interface{}) interface{} {
 
 		for key, value := range values.(map[string]interface{}) {
 			if key == "var" {
-				if value == "" || strings.HasPrefix(value.(string), ".") {
+				if isString(value) && (value == "" || strings.HasPrefix(value.(string), ".")) {
 					logic["var"] = value
 					continue
 				}


Test patch:
diff --git a/jsonlogic_test.go b/jsonlogic_test.go
index 07b0b02..aa9e548 100644
--- a/jsonlogic_test.go
+++ b/jsonlogic_test.go
@@ -741,6 +741,30 @@ func TestIssue58_example(t *testing.T) {
 	assert.JSONEq(t, expected, result.String())
 }
 
+func TestIssue70(t *testing.T) {
+	data := strings.NewReader(`{"people": [
+		{"age":18, "name":"John"},
+		{"age":20, "name":"Luke"},
+		{"age":18, "name":"Mark"}
+]}`)
+	logic := strings.NewReader(`{"filter": [
+	{"var": ["people"]},
+	{"==": [{"var": ["age"]}, 18]}
+]}`)
+
+	var result bytes.Buffer
+	err := Apply(logic, data, &result)
+	if err != nil {
+		t.Fatal(err)
+	}
+
+	expected := `[
+    {"age": 18, "name": "John"},
+    {"age": 18, "name": "Mark"}
+]`
+	assert.JSONEq(t, expected, result.String())
+}
+
 func TestIssue71_example_empty_min(t *testing.T) {
 	data := strings.NewReader(`{}`)
 	logic := strings.NewReader(`{"min":[]}`)