From d4e5e218f75807d959df2fffb78ea9fc6e5466b5 Mon Sep 17 00:00:00 2001
From: Alexey Lunin <alexey.lunin@vereign.com>
Date: Wed, 13 Mar 2019 15:57:08 +0400
Subject: [PATCH] Remove comma from generated penpal methods which don't have
 args in form

---
 main.go | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/main.go b/main.go
index 22f03bb..af0efbc 100644
--- a/main.go
+++ b/main.go
@@ -123,7 +123,13 @@ func buildViamAPI() string {
 				}
 			}
 
-			result += "ViamAPI.prototype." + packageStr + strings.Title(methodStr) + " = function(config, " + args + ") {\n" +
+			lastComma := ","
+
+			if args == "" {
+				lastComma = ""
+			}
+
+			result += "ViamAPI.prototype." + packageStr + strings.Title(methodStr) + " = function(config" + lastComma + args + ") {\n" +
 				"    return axios.post(window.API_HOST + '" + packageStr + "/" + methodStr + "', {\n"
 
 			for i := 0; i < lenFields; i++ {
-- 
GitLab