// AnnotateOne annotates a single variant with the vals func (s *Source) AnnotateOne(v interfaces.IVariant, vals []interface{}, prefix string) { if len(vals) == 0 { return } if s.code != "" { luaval := s.LuaOp(v, s.code, vals) if luaval == "true" || luaval == "false" && strings.Contains(s.Op, "_flag(") { if luaval == "true" { v.Info().Set(prefix+s.Name, true) } } else { v.Info().Set(prefix+s.Name, luaval) } } else { val := Reducers[s.Op](vals) v.Info().Set(prefix+s.Name, val) } }
func (src *Source) AnnotateOne(v interfaces.IVariant, vals []interface{}, prefix string) { if len(vals) == 0 { return } if src.Js != nil { jsval := src.JsOp(v, src.Js, vals) if jsval == "true" || jsval == "false" && strings.Contains(src.Op, "_flag(") { if jsval == "true" { v.Info().Set(prefix+src.Name, true) } } else { v.Info().Set(prefix+src.Name, jsval) } } else { val := Reducers[src.Op](vals) v.Info().Set(prefix+src.Name, val) } }