Accept anything with function 'submit' as a query

This allows for passing in custom objects which conform to the query API
This commit is contained in:
Brian M. Carlson 2013-10-21 13:29:17 -05:00
parent a72bd5cb3c
commit 894c60e605

View File

@ -284,7 +284,7 @@ Client.prototype.copyTo = function (text) {
Client.prototype.query = function(config, values, callback) { Client.prototype.query = function(config, values, callback) {
//can take in strings, config object or query object //can take in strings, config object or query object
var query = (config instanceof Query) ? config : var query = (typeof config.submit == 'function') ? config :
new Query(config, values, callback); new Query(config, values, callback);
if(this.binary && !query.binary) { if(this.binary && !query.binary) {
query.binary = true; query.binary = true;