then-redis
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -62,3 +62,3 @@ var _slice = Array.prototype.slice; | ||
// Optionall accept a hash as the only argument to MSET. | ||
// Optionally accept a hash as the only argument to MSET. | ||
commands.mset = function (hash) { | ||
@@ -69,2 +69,8 @@ var args = (typeof hash === 'object') ? appendHashToArray(hash, []) : _slice.call(arguments, 0); | ||
// Optionally accept a hash as the only argument to MSETNX. | ||
commands.msetnx = function (hash) { | ||
var args = (typeof hash === 'object') ? appendHashToArray(hash, []) : _slice.call(arguments, 0); | ||
return this.send('msetnx', args); | ||
}; | ||
// Optionally accept a hash as the first argument to HMSET after the key. | ||
@@ -71,0 +77,0 @@ commands.hmset = function (key, hash) { |
{ | ||
"name": "then-redis", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "A small, promise-based Redis client", | ||
@@ -23,2 +23,3 @@ "main": "lib/index.js", | ||
"redis", | ||
"then", | ||
"promise", | ||
@@ -25,0 +26,0 @@ "promises" |
@@ -15,3 +15,3 @@ then-redis | ||
\* Except for `MSET`, `HMSET` and `HGETALL` which optionally accept/return hashes (i.e. JavaScript objects) for convenience. | ||
\* `MSET`, `MSETNX`, `HMSET` and `HGETALL` optionally accept/return JavaScript objects for convenience in dealing with Redis' multi-key and hash APIs | ||
@@ -92,2 +92,3 @@ Usage | ||
$ redis-server --port 6379 | ||
$ npm install | ||
@@ -94,0 +95,0 @@ $ npm test |
@@ -5,3 +5,3 @@ require('./helper'); | ||
describe('when given a list of fields/values', function () { | ||
it('sets all fields to the correct values', function () { | ||
it('sets all keys to the correct values', function () { | ||
return db.mset('a', 'one', 'b', 'two', 'c', 'three').then(function () { | ||
@@ -16,3 +16,3 @@ return db.mget('a', 'b', 'c').then(function (values) { | ||
describe('when given a hash', function () { | ||
it('sets all fields to the correct values', function () { | ||
it('sets all keys to the correct values', function () { | ||
return db.mset({ a: 'one', b: 'two', c: 'three' }).then(function () { | ||
@@ -19,0 +19,0 @@ return db.mget('a', 'b', 'c').then(function (values) { |
33583
31
888
105