Skip to content

Node.js based forum software built for the modern web

linting, TIL that obj.$key is valid syntax

psychobunnyf149fb0191d6
diff --git a/src/database/mongo/sorted.js b/src/database/mongo/sorted.js
index 5af9d8bd7f..86beb9bf29 100644
--- a/src/database/mongo/sorted.js
+++ b/src/database/mongo/sorted.js
@@ -110,7 +110,7 @@ module.exports = function(db, module) {
var fields = {_id: 0, value: 1};
if (withScores) {
- fields['score'] = 1;
+ fields.score = 1;
}
db.collection('objects').find({_key:key}, {fields: fields})
.limit(stop - start + 1)
@@ -165,15 +165,15 @@ module.exports = function(db, module) {
var scoreQuery = {};
if (min !== -Infinity) {
- scoreQuery['$gte'] = min;
+ scoreQuery.$gte = min;
}
if (max !== Infinity) {
- scoreQuery['$lte'] = max;
+ scoreQuery.$lte = max;
}
var fields = {_id: 0, value: 1};
if (withScores) {
- fields['score'] = 1;
+ fields.score = 1;
}
db.collection('objects').find({_key:key, score: scoreQuery}, {fields: fields})
@@ -440,7 +440,7 @@ module.exports = function(db, module) {
}
var data = {};
value = helpers.fieldToString(value);
- data['score'] = parseInt(increment, 10);
+ data.score = parseInt(increment, 10);
db.collection('objects').findAndModify({_key: key, value: value}, {}, {$inc: data}, {new:true, upsert:true}, function(err, result) {
callback(err, result ? result[value] : null);
diff --git a/src/database/redis.js b/src/database/redis.js
index 8e5e5e2216..570184bc8a 100644
--- a/src/database/redis.js
+++ b/src/database/redis.js
@@ -78,7 +78,9 @@
var redis_socket_or_host = nconf.get('redis:host'),
cxn, dbIdx;
- if (!redis) redis = require('redis');
+ if (!redis) {
+ redis = require('redis');
+ }
if (redis_socket_or_host && redis_socket_or_host.indexOf('/') >= 0) {
/* If redis.host contains a path name character, use the unix dom sock connection. ie, /tmp/redis.sock */
diff --git a/src/middleware/index.js b/src/middleware/index.js
index e868ee4476..e1b7c0c218 100644
--- a/src/middleware/index.js
+++ b/src/middleware/index.js
@@ -30,8 +30,9 @@ var utils = require('./../../public/src/utils'),
var middleware = {};
function routeCurrentTheme(app, themeId, themesData) {
- var themeId = (themeId || 'nodebb-theme-vanilla'),
- themeObj = (function(id) {
+ themeId = (themeId || 'nodebb-theme-vanilla');
+
+ var themeObj = (function(id) {
return themesData.filter(function(themeObj) {
return themeObj.id === id;
})[0];