then-redis
Advanced tools
Comparing version 1.0.3 to 1.1.0
@@ -164,5 +164,12 @@ var url = require('url'); | ||
var client = this._redisClient; | ||
return this.send('select', [ db ]).then(function (value) { | ||
client.selected_db = db; | ||
return value; | ||
return new Promise(function (resolve, reject) { | ||
// Need to use this so selected_db updates properly. | ||
client.select(db, function (error, value) { | ||
if (error) { | ||
reject(error); | ||
} else { | ||
resolve(value); | ||
} | ||
}); | ||
}); | ||
@@ -174,2 +181,12 @@ } | ||
// Optionally accept an array as the first argument to LPUSH and RPUSH after the key. | ||
[ 'lpush', 'rpush' ].forEach(function (command) { | ||
Object.defineProperty(Client.prototype, command, { | ||
value: function (key, array) { | ||
var args = Array.isArray(array) ? [ key ].concat(array) : slice.call(arguments, 0); | ||
return this.send(command, args); | ||
} | ||
}); | ||
}); | ||
PROPERTIES.forEach(function (propertyName) { | ||
@@ -176,0 +193,0 @@ Object.defineProperty(Client.prototype, propertyName, { |
{ | ||
"name": "then-redis", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "A small, promise-based Redis client", | ||
@@ -5,0 +5,0 @@ "main": "modules/index.js", |
@@ -79,3 +79,3 @@ [![npm package](https://img.shields.io/npm/v/then-redis.svg?style=flat-square)](https://www.npmjs.org/package/then-redis) | ||
\* `INFO`, `MSET`, `MSETNX`, `HMSET` and `HGETALL` optionally accept/return JavaScript objects for convenience in dealing with Redis' multi-key and hash APIs | ||
\* `INFO`, `MSET`, `MSETNX`, `HMSET`, `HGETALL`, `LPUSH`, and `RPUSH` optionally accept/return JavaScript objects for convenience in dealing with Redis' multi-key and hash APIs | ||
@@ -82,0 +82,0 @@ ### Compatibility |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10057
200