Comparing version 0.5.5 to 0.5.6
{ | ||
"name": "grex", | ||
"description": "Client for Rexster Graph Server", | ||
"version": "0.5.5", | ||
"version": "0.5.6", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "database", |
@@ -17,11 +17,11 @@ var http = require('http'); | ||
function Grex(options) { | ||
var defaultOptions = { | ||
this.defaultOptions = { | ||
host: 'localhost', | ||
port: 8182, | ||
graph: 'tinkergraph', | ||
idRegex: false, // OrientDB id regex -> /^[0-9]+:[0-9]+$/ | ||
fetched: function(response, results) { return results; } | ||
idRegex: false // OrientDB id regex -> /^[0-9]+:[0-9]+$/ | ||
// fetched: function(response, results) { return results; } | ||
}; | ||
this.options = _.defaults(options, defaultOptions); | ||
this.options = _.defaults(options, this.defaultOptions); | ||
@@ -43,5 +43,7 @@ this.resultFormatter = new ResultFormatter(); | ||
// Set options to previously setup options or switch back to the defaults | ||
this.options = this.options || defaultOptions; | ||
this.options = this.options || this.defaultOptions; | ||
} | ||
this.fetchHandler = this.options.fetched || this.defaultFetchHandler; | ||
return Q.fcall(function() { | ||
@@ -104,6 +106,10 @@ return this; | ||
.then(function(response) { | ||
return this.options.fetched(response, response.results); | ||
return this.fetchHandler(response, response.results); | ||
}.bind(this)); | ||
}; | ||
Grex.prototype.defaultFetchHandler = function(response, results) { | ||
return results; | ||
}; | ||
Grex.prototype.gremlin = function(options) { | ||
@@ -110,0 +116,0 @@ var gremlin = new Gremlin(this, options); |
@@ -24,7 +24,7 @@ var gRex = require('../index.js'), | ||
console.error(error); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
describe('when passing custom options', function() { | ||
@@ -47,2 +47,3 @@ var client; | ||
console.error(error); | ||
done(); | ||
}); | ||
@@ -57,3 +58,2 @@ }); | ||
describe('when instantiating Grex with custom options', function() { | ||
@@ -73,3 +73,2 @@ var options = { | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
706731
16797