Skip to content

Commit

Permalink
Handle Non-array Objects Correctly; Version Lock Dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonodk committed Jan 3, 2014
1 parent 75f651d commit 818a101
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
9 changes: 6 additions & 3 deletions lib/stores/hashring.js
Expand Up @@ -20,12 +20,15 @@ function HashRingStore(options) {
break;

case 'object':
servers = options.servers;
if (Array.isArray(options.servers)) {
servers = options.servers;
} else {
throw new Error('Caching Hash Ring Store requires that servers option be a string or an array. Type was non-array object.');
}
break;

case 'undefined':
default:
throw new Error('Caching Hash Ring Store requires an servers option to be set.');
throw new Error('Caching Hash Ring Store requires that servers option be a string or an array. Type was ' + typeof options.servers);
break;
}

Expand Down
12 changes: 6 additions & 6 deletions package.json
@@ -1,7 +1,7 @@
{
"name": "caching",
"description": "Easier caching in node.js",
"version": "0.2.0",
"description": "Easier caching in node.js. Now with consistent hashing.",
"version": "0.2.1",
"author": "Mathias Pettersson <mape@mape.me>",
"contributors": [
{
Expand All @@ -21,12 +21,12 @@
"url": "http://github.com/wilsonodk/node-caching"
},
"dependencies": {
"hiredis": ">=0.1.12",
"redis": ">=0.6.7",
"hashring": "~1.0.3"
"hiredis": "0.1.12",
"redis": "0.6.7",
"hashring": "1.0.3"
},
"devDependencies": {
"expresso": "~0.8.1"
"expresso": "0.8.1"
},
"scripts": {
"test": "expresso"
Expand Down

0 comments on commit 818a101

Please sign in to comment.