Last active
December 29, 2015 23:49
-
-
Save ralexstokes/7745790 to your computer and use it in GitHub Desktop.
RedisClient.prototype.hmset
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -1033,8 +1033,15 @@ RedisClient.prototype.hmset = function (args, callback) { | |
callback = null; | |
} | |
- if (args.length === 2 && typeof args[0] === "string" && typeof args[1] === "object") { | |
+ if (args.length === 2 && (typeof args[0] === "string" || typeof args[0] === "number") && typeof args[1] === "object") { | |
// User does: client.hmset(key, {key1: val1, key2: val2}) | |
+ // assuming key is a string, i.e. email address | |
+ | |
+ // if key is a number, i.e. timestamp, convert to string | |
+ if (typeof args[0] === "number") { | |
+ args[0] = args[0].toString(); | |
+ } | |
+ | |
tmp_args = [ args[0] ]; | |
tmp_keys = Object.keys(args[1]); | |
for (i = 0, il = tmp_keys.length; i < il ; i++) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment