From c0c20e60f3c7ec14f1107fac415c326a56e813c8 Mon Sep 17 00:00:00 2001 From: Mike Carson Date: Tue, 20 Aug 2013 17:54:34 -0400 Subject: [PATCH] fix spacing --- lib/connect-firebase.js | 46 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/lib/connect-firebase.js b/lib/connect-firebase.js index d3ba172..e8a8bb4 100644 --- a/lib/connect-firebase.js +++ b/lib/connect-firebase.js @@ -42,8 +42,8 @@ module.exports = function (connect) { this.firebase_url = options.firebase_url; this.token = options.token; - this.clean_sid = options.clean_sid || function(sid) { - return sid.replace('.', '_'); + this.clean_sid = options.clean_sid || function (sid) { + return sid.replace('.', '_'); } if (this.token) { @@ -69,28 +69,28 @@ module.exports = function (connect) { FirebaseStore.prototype.get = function (sid, fn) { - var self = this; - sid = this.clean_sid(sid); + var self = this; + sid = this.clean_sid(sid); var now = +new Date; var sessionRef = new Firebase('https://' + this.firebase_url + '/sessions/' + sid); sessionRef.once('value', function (snapshot) { - try { - if (!snapshot || snapshot.val() === null) { - return fn(null, null); - } else { - if (!snapshot.val()) return fn(null, null); - else if (snapshot.val().expires && now >= snapshot.val().expires) { - self.destroy(sid, fn); - } else { - var sess = snapshot.val().sess.toString(); - sess = JSON.parse(sess); - return fn(null, sess); - } - } + try { + if (!snapshot || snapshot.val() === null) { + return fn(null, null); + } else { + if (!snapshot.val()) return fn(null, null); + else if (snapshot.val().expires && now >= snapshot.val().expires) { + self.destroy(sid, fn); + } else { + var sess = snapshot.val().sess.toString(); + sess = JSON.parse(sess); + return fn(null, sess); + } + } } catch (err) { - fn(err); - } + fn(err); + } }); }; @@ -106,17 +106,17 @@ module.exports = function (connect) { FirebaseStore.prototype.set = function (sid, sess, fn) { - sid = this.clean_sid(sid); + sid = this.clean_sid(sid); var expires = typeof sess.cookie.maxAge === 'number' ? (+new Date()) + sess.cookie.maxAge : (+new Date()) + oneDayInMilliseconds; sess_string = JSON.stringify(sess); var sessionRef = new Firebase('https://' + this.firebase_url + '/sessions/' + sid); sessionRef.set({ - expires: JSON.stringify(expires), + expires: JSON.stringify(expires), type: 'connect-session', sess: sess_string }, fn); - + } /** @@ -132,7 +132,7 @@ module.exports = function (connect) { sid = this.clean_sid(sid); var sessionRef = new Firebase('https://' + this.firebase_url + '/sessions/' + sid); sessionRef.remove(fn); - + }; return FirebaseStore;