Merge pull request #186 from indexzero/fix-redis
Fix some minor consistency issues in Redis
This commit is contained in:
commit
e503718468
1 changed files with 9 additions and 3 deletions
|
@ -210,6 +210,12 @@ Provider.prototype.init = function (options) {
|
||||||
// Retrieves the value for the specified key (if any).
|
// Retrieves the value for the specified key (if any).
|
||||||
//
|
//
|
||||||
Provider.prototype.get = function (key, callback) {
|
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
|
// If there is no callback we can short-circuit into the default
|
||||||
// logic for traversing stores.
|
// logic for traversing stores.
|
||||||
|
@ -244,7 +250,7 @@ Provider.prototype.get = function (key, callback) {
|
||||||
response = value;
|
response = value;
|
||||||
|
|
||||||
// Merge objects if necessary
|
// Merge objects if necessary
|
||||||
if (typeof response === 'object' && !Array.isArray(response)) {
|
if (response && typeof response === 'object' && !Array.isArray(response)) {
|
||||||
mergeObjs.push(response);
|
mergeObjs.push(response);
|
||||||
response = undefined;
|
response = undefined;
|
||||||
}
|
}
|
||||||
|
@ -256,7 +262,7 @@ Provider.prototype.get = function (key, callback) {
|
||||||
response = store.get(key);
|
response = store.get(key);
|
||||||
|
|
||||||
// Merge objects if necessary
|
// Merge objects if necessary
|
||||||
if (typeof response === 'object' && !Array.isArray(response)) {
|
if (response && typeof response === 'object' && !Array.isArray(response)) {
|
||||||
mergeObjs.push(response);
|
mergeObjs.push(response);
|
||||||
response = undefined;
|
response = undefined;
|
||||||
}
|
}
|
||||||
|
@ -462,7 +468,7 @@ Provider.prototype.save = function (value, callback) {
|
||||||
//
|
//
|
||||||
|
|
||||||
if (store.save) {
|
if (store.save) {
|
||||||
return store.save(function (err, data) {
|
return store.save(value, function (err, data) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue