Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

GETRANGE type checks

  • Loading branch information...
commit 00e55c97c3dac775f330dfa63ba268ad9f014e88 1 parent 5927e61
@tj authored
Showing with 12 additions and 1 deletion.
  1. +12 −1 lib/commands/string.js
View
13 lib/commands/string.js
@@ -134,6 +134,14 @@ exports.append = function(client, key, str){
};
/**
+ * SETRANGE <key> <offset> <val>
+ */
+
+exports.setrange = function(client, key, offset, val){
+
+};
+
+/**
* GETRANGE <key> <from> <to>
*/
@@ -144,6 +152,9 @@ exports.getrange = function(client, key, from, to){
, from = +utils.string(from)
, to = +utils.string(to);
+ if (isNaN(from)) return client.typeError();
+ if (isNaN(to)) return client.typeError();
+
// Clamp positive
if (from > len) from = len;
if (to > len) to = len;
@@ -159,7 +170,7 @@ exports.getrange = function(client, key, from, to){
if (null == val) {
client.nil();
} else {
- client.send(val.slice(from, to + 1));
+ client.send(val.slice(from, to + 1));
}
};
Please sign in to comment.
Something went wrong with that request. Please try again.