From 24b664efbd2104f4cdc2ab5a2d2a84491dee4cd1 Mon Sep 17 00:00:00 2001 From: brianc Date: Mon, 15 Aug 2011 20:57:39 -0500 Subject: [PATCH] fix js/native api inconsistency --- lib/native.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/native.js b/lib/native.js index ef3b460..e51726b 100644 --- a/lib/native.js +++ b/lib/native.js @@ -100,11 +100,17 @@ var ctor = function(config) { //event emitter proxy var NativeQuery = function(text, values, callback) { + //TODO there are better ways to detect overloads if(typeof text == 'object') { this.text = text.text; this.values = text.values; this.name = text.name; - this.callback = values; + if(typeof values === 'function') { + this.callback = values; + } else if(typeof values !== 'undefined') { + this.values = values; + this.callback = callback; + } } else { this.text = text; this.values = values;