Merge pull request #186 from indexzero/fix-redis

Fix some minor consistency issues in Redis
This commit is contained in:
Charlie Robbins 2015-09-20 01:14:43 -07:00
commit e503718468

View file

@ -210,6 +210,12 @@ Provider.prototype.init = function (options) {
// Retrieves the value for the specified key (if any).
//
Provider.prototype.get = function (key, callback) {
if (typeof key === 'function') {
// Allow a * key call to be made
callback = key;
key = null;
}
//
// If there is no callback we can short-circuit into the default
// logic for traversing stores.
@ -244,7 +250,7 @@ Provider.prototype.get = function (key, callback) {
response = value;
// Merge objects if necessary
if (typeof response === 'object' && !Array.isArray(response)) {
if (response && typeof response === 'object' && !Array.isArray(response)) {
mergeObjs.push(response);
response = undefined;
}
@ -256,7 +262,7 @@ Provider.prototype.get = function (key, callback) {
response = store.get(key);
// Merge objects if necessary
if (typeof response === 'object' && !Array.isArray(response)) {
if (response && typeof response === 'object' && !Array.isArray(response)) {
mergeObjs.push(response);
response = undefined;
}
@ -462,7 +468,7 @@ Provider.prototype.save = function (value, callback) {
//
if (store.save) {
return store.save(function (err, data) {
return store.save(value, function (err, data) {
if (err) {
return next(err);
}