From 7273b9f704277de6fafe7fdb28963e461f2e87f4 Mon Sep 17 00:00:00 2001 From: Steve Date: Fri, 20 Apr 2018 11:40:31 +0100 Subject: [PATCH] fix --- firebase.coffee | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/firebase.coffee b/firebase.coffee index 0313bc9..e5dd3a3 100644 --- a/firebase.coffee +++ b/firebase.coffee @@ -63,20 +63,20 @@ class exports.Firebase extends Framer.BaseClass return r # Third argument can also accept options, rather than callback - parseArgs = (args..., cb) -> - if typeof args[2] is "object" - args[3] = args[2] - args[2] = null + parseArgs = (l, args..., cb) -> + if typeof args[l-1] is "object" + args[l] = args[l-1] + args[l-1] = null return cb.apply(null, args) # Available methods - get: (args...) -> parseArgs args..., (path, callback, parameters) => request(@projectID, @secretEndPoint, path, callback, "GET", null, parameters, @debug) - put: (args...) -> parseArgs args..., (path, data, callback, parameters) => request(@projectID, @secretEndPoint, path, callback, "PUT", data, parameters, @debug) - post: (args...) -> parseArgs args..., (path, data, callback, parameters) => request(@projectID, @secretEndPoint, path, callback, "POST", data, parameters, @debug) - patch: (args...) -> parseArgs args..., (path, data, callback, parameters) => request(@projectID, @secretEndPoint, path, callback, "PATCH", data, parameters, @debug) - delete: (args...) -> parseArgs args..., (path, callback, parameters) => request(@projectID, @secretEndPoint, path, callback, "DELETE", null, parameters, @debug) + get: (args...) -> parseArgs 2, args..., (path, callback, parameters) => request(@projectID, @secretEndPoint, path, callback, "GET", null, parameters, @debug) + put: (args...) -> parseArgs 3, args..., (path, data, callback, parameters) => request(@projectID, @secretEndPoint, path, callback, "PUT", data, parameters, @debug) + post: (args...) -> parseArgs 3, args..., (path, data, callback, parameters) => request(@projectID, @secretEndPoint, path, callback, "POST", data, parameters, @debug) + patch: (args...) -> parseArgs 3, args..., (path, data, callback, parameters) => request(@projectID, @secretEndPoint, path, callback, "PATCH", data, parameters, @debug) + delete: (args...) -> parseArgs 2, args..., (path, callback, parameters) => request(@projectID, @secretEndPoint, path, callback, "DELETE", null, parameters, @debug) onChange: (path, callback) ->