소스 검색

Add Exists function

Svilen Markov 5 달 전
부모
커밋
8331c4b305
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      internal/glance/widget-custom-api.go

+ 4 - 0
internal/glance/widget-custom-api.go

@@ -133,6 +133,10 @@ func gJsonResultArrayToDecoratedResultArray(results []gjson.Result) []decoratedG
 	return decoratedResults
 }
 
+func (r *decoratedGJSONResult) Exists(key string) bool {
+	return r.Get(key).Exists()
+}
+
 func (r *decoratedGJSONResult) Array(key string) []decoratedGJSONResult {
 	if key == "" {
 		return gJsonResultArrayToDecoratedResultArray(r.Result.Array())