tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jorg...@apache.org
Subject [14/50] [abbrv] tinkerpop git commit: Use null as empty result
Date Mon, 08 Jan 2018 10:37:45 GMT
Use null as empty result


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/ca2f349c
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/ca2f349c
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/ca2f349c

Branch: refs/heads/TINKERPOP-1489
Commit: ca2f349c475c51350286f3205898c2aff67f046a
Parents: 08bdc0b
Author: Jorge Bay Gondra <jorgebaygondra@gmail.com>
Authored: Thu Nov 3 14:34:28 2016 +0100
Committer: Jorge Bay Gondra <jorgebaygondra@gmail.com>
Committed: Mon Jan 8 11:28:32 2018 +0100

----------------------------------------------------------------------
 .../tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy   | 2 +-
 .../src/main/javascript/gremlin-javascript/process/traversal.js    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ca2f349c/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy
b/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy
index 46f65a4..d5899f0 100644
--- a/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy
+++ b/gremlin-javascript/src/main/groovy/org/apache/tinkerpop/gremlin/javascript/TraversalSourceGenerator.groovy
@@ -87,7 +87,7 @@ class TraversalSourceGenerator {
   /** @param {Function} callback */
   Traversal.prototype.one = function (callback) {
     this.list(function (err, result) {
-      callback(err, result ? result[0] : null);
+      callback(err, result && result.length > 0 ? result[0] : null);
     });
   };
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ca2f349c/gremlin-javascript/src/main/javascript/gremlin-javascript/process/traversal.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/process/traversal.js
b/gremlin-javascript/src/main/javascript/gremlin-javascript/process/traversal.js
index a7a9bb7..f585161 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/process/traversal.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/process/traversal.js
@@ -50,7 +50,7 @@
   /** @param {Function} callback */
   Traversal.prototype.one = function (callback) {
     this.list(function (err, result) {
-      callback(err, result ? result[0] : null);
+      callback(err, result && result.length > 0 ? result[0] : null);
     });
   };
 


Mime
View raw message