then-redis
Advanced tools
Comparing version 1.2.1 to 1.2.2
var url = require('url'); | ||
var redis = require('redis'); | ||
var d = require('describe-property'); | ||
var EventEmitter = require('events').EventEmitter; | ||
@@ -130,65 +131,52 @@ var appendHashToArray = require('./utils/appendHashToArray'); | ||
// Parse the result of INFO. | ||
info: { | ||
value: function () { | ||
return this.send('info').then(parseInfo); | ||
} | ||
}, | ||
info: d(function () { | ||
return this.send('info').then(parseInfo); | ||
}), | ||
// Optionally accept an array as the only argument to MGET. | ||
mget: { | ||
value: function (keys) { | ||
var args = Array.isArray(keys) ? keys : slice.call(arguments, 0); | ||
return this.send('mget', args); | ||
} | ||
}, | ||
mget: d(function (keys) { | ||
var args = Array.isArray(keys) ? keys : slice.call(arguments, 0); | ||
return this.send('mget', args); | ||
}), | ||
// Optionally accept a hash as the only argument to MSET. | ||
mset: { | ||
value: function (hash) { | ||
var args = (typeof hash === 'object') ? appendHashToArray(hash, []) : slice.call(arguments, 0); | ||
return this.send('mset', args); | ||
} | ||
}, | ||
mset: d(function (hash) { | ||
var args = (typeof hash === 'object') ? appendHashToArray(hash, []) : slice.call(arguments, 0); | ||
return this.send('mset', args); | ||
}), | ||
// Optionally accept a hash as the only argument to MSETNX. | ||
msetnx: { | ||
value: function (hash) { | ||
var args = (typeof hash === 'object') ? appendHashToArray(hash, []) : slice.call(arguments, 0); | ||
return this.send('msetnx', args); | ||
} | ||
}, | ||
msetnx: d(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. | ||
hmset: { | ||
value: function (key, hash) { | ||
var args = (typeof hash === 'object') ? appendHashToArray(hash, [ key ]) : slice.call(arguments, 0); | ||
return this.send('hmset', args); | ||
} | ||
}, | ||
hmset: d(function (key, hash) { | ||
var args = (typeof hash === 'object') ? appendHashToArray(hash, [ key ]) : slice.call(arguments, 0); | ||
return this.send('hmset', args); | ||
}), | ||
// Update the selected_db property of the client on SELECT. | ||
select: { | ||
value: function (db) { | ||
var client = this._redisClient; | ||
select: d(function (db) { | ||
var client = this._redisClient; | ||
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); | ||
} | ||
}); | ||
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); | ||
} | ||
}); | ||
} | ||
}, | ||
}); | ||
}), | ||
// Optionally accept an array as the only argument to DEL. | ||
del: { | ||
value: function (keys) { | ||
var args = Array.isArray(keys) ? keys : slice.call(arguments, 0); | ||
return this.send('del', args); | ||
} | ||
} | ||
del: d(function (keys) { | ||
var args = Array.isArray(keys) ? keys : slice.call(arguments, 0); | ||
return this.send('del', args); | ||
}) | ||
}); | ||
@@ -198,16 +186,12 @@ | ||
[ '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); | ||
} | ||
}); | ||
Object.defineProperty(Client.prototype, command, d(function (key, array) { | ||
var args = Array.isArray(array) ? [ key ].concat(array) : slice.call(arguments, 0); | ||
return this.send(command, args); | ||
})); | ||
}); | ||
PROPERTIES.forEach(function (propertyName) { | ||
Object.defineProperty(Client.prototype, propertyName, { | ||
get: function () { | ||
return this._redisClient[propertyName]; | ||
} | ||
}); | ||
Object.defineProperty(Client.prototype, propertyName, d.gs(function () { | ||
return this._redisClient[propertyName]; | ||
})); | ||
}); | ||
@@ -222,9 +206,7 @@ | ||
Object.defineProperty(Client.prototype, command, { | ||
value: function () { | ||
return this.send(command, slice.call(arguments, 0)); | ||
} | ||
}); | ||
Object.defineProperty(Client.prototype, command, d(function () { | ||
return this.send(command, slice.call(arguments, 0)); | ||
})); | ||
}); | ||
module.exports = Client; |
{ | ||
"name": "then-redis", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "A small, promise-based Redis client", | ||
@@ -14,3 +14,4 @@ "main": "modules/index.js", | ||
"dependencies": { | ||
"bluebird": "^2.3.11" | ||
"bluebird": "^2.3.11", | ||
"describe-property": "^1.0.0" | ||
}, | ||
@@ -17,0 +18,0 @@ "devDependencies": { |
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
12
10462
3
195
+ Addeddescribe-property@^1.0.0
+ Addeddescribe-property@1.1.0(transitive)
+ Addedobject-assign@2.1.1(transitive)