You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2021/02/12 22:11:31 UTC

[tinkerpop] 01/04: Fixed the Javascript template that didn't have the change from 76bc8c98c68218c183a41ba6a4d6fdab0740bb5c CTR

This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit b156546e330fafd5321f261bd9b14d87ccecbb28
Author: Stephen Mallette <st...@amazon.com>
AuthorDate: Fri Feb 12 16:48:26 2021 -0500

    Fixed the Javascript template that didn't have the change from 76bc8c98c68218c183a41ba6a4d6fdab0740bb5c CTR
---
 gremlin-javascript/glv/TraversalSource.template | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gremlin-javascript/glv/TraversalSource.template b/gremlin-javascript/glv/TraversalSource.template
index 4873409..bf9a428 100644
--- a/gremlin-javascript/glv/TraversalSource.template
+++ b/gremlin-javascript/glv/TraversalSource.template
@@ -166,13 +166,20 @@ class P {
    */
   toString() {
     function formatValue(value){
+      if (Array.isArray(value)) {
+        let acc = [];
+        for (const item of value) {
+          acc.push(formatValue(item));
+        }
+        return acc;
+      }
       if (value && typeof value === "string"){
         return "'" + value + "'";
       }
       return value;
     }
 
-    if (this.other === undefined) {
+    if (this.other === undefined || this.other === null) {
       return this.operator + '(' + formatValue(this.value) + ')';
     }
     return this.operator + '(' + formatValue(this.value) + ', ' + formatValue(this.other) + ')';