@@ -33,6 +33,10 @@ type Node struct {
3333 FunctionMap dfl.FunctionMap
3434}
3535
36+ func (n Node ) Pretty () string {
37+ return n .Node .Dfl (GO_DFL_DEFAULT_QUOTES [1 :], true , 0 )
38+ }
39+
3640func (n Node ) Compile () * js.Object {
3741 return js .MakeWrapper (Node {
3842 Node : n .Node .Compile (),
@@ -49,7 +53,7 @@ func (n Node) Evaluate(options *js.Object) interface{} {
4953
5054 result , err := n .Node .Evaluate (ctx , n .FunctionMap , GO_DFL_DEFAULT_QUOTES [1 :])
5155 if err != nil {
52- console .Log (err .Error ())
56+ console .Error (err .Error ())
5357 return false
5458 }
5559 return result
@@ -91,7 +95,7 @@ func EvaluateBool(s string, options *js.Object) bool {
9195
9296 result , err := dfl .EvaluateBool (root , ctx , dfl .NewFuntionMapWithDefaults (), GO_DFL_DEFAULT_QUOTES [1 :])
9397 if err != nil {
94- console .Log (err .Error ())
98+ console .Error (err .Error ())
9599 return false
96100 }
97101
@@ -101,7 +105,7 @@ func EvaluateBool(s string, options *js.Object) bool {
101105func EvaluateInt (s string , options * js.Object ) int {
102106 root , err := dfl .Parse (s )
103107 if err != nil {
104- console .Log (err .Error ())
108+ console .Error (err .Error ())
105109 return 0
106110 }
107111
@@ -114,7 +118,7 @@ func EvaluateInt(s string, options *js.Object) int {
114118
115119 result , err := dfl .EvaluateInt (root , ctx , dfl .NewFuntionMapWithDefaults (), GO_DFL_DEFAULT_QUOTES [1 :])
116120 if err != nil {
117- console .Log (err .Error ())
121+ console .Error (err .Error ())
118122 return 0
119123 }
120124
@@ -124,7 +128,7 @@ func EvaluateInt(s string, options *js.Object) int {
124128func EvaluateFloat64 (s string , options * js.Object ) float64 {
125129 root , err := dfl .Parse (s )
126130 if err != nil {
127- console .Log (err .Error ())
131+ console .Error (err .Error ())
128132 return 0.0
129133 }
130134
@@ -137,7 +141,7 @@ func EvaluateFloat64(s string, options *js.Object) float64 {
137141
138142 result , err := dfl .EvaluateFloat64 (root , ctx , dfl .NewFuntionMapWithDefaults (), GO_DFL_DEFAULT_QUOTES [1 :])
139143 if err != nil {
140- console .Log (err .Error ())
144+ console .Error (err .Error ())
141145 return 0.0
142146 }
143147
@@ -147,7 +151,7 @@ func EvaluateFloat64(s string, options *js.Object) float64 {
147151func EvaluateString (s string , options * js.Object ) string {
148152 root , err := dfl .Parse (s )
149153 if err != nil {
150- console .Log (err .Error ())
154+ console .Error (err .Error ())
151155 return ""
152156 }
153157
@@ -158,9 +162,9 @@ func EvaluateString(s string, options *js.Object) string {
158162 ctx [key ] = options .Get (key ).Interface ()
159163 }
160164
161- result , err := dfl .EvaluateString (root , ctx , dfl .NewFuntionMapWithDefaults () GO_DFL_DEFAULT_QUOTES [1 :])
165+ result , err := dfl .EvaluateString (root , ctx , dfl .NewFuntionMapWithDefaults (), GO_DFL_DEFAULT_QUOTES [1 :])
162166 if err != nil {
163- console .Log (err .Error ())
167+ console .Error (err .Error ())
164168 return ""
165169 }
166170
0 commit comments