You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
@@ -11,6 +11,10 @@ Features
|
||||
- The JS parser is from now on the new default as it is a lot faster than the hiredis parser
|
||||
- This is no BC as there is no changed behavior for the user at all but just a performance improvement. Explicitly requireing the Hiredis parser is still possible.
|
||||
|
||||
Bugfixes
|
||||
|
||||
- Reverted support for `__proto__` (v.2.6.0-2) to prevent and breaking change
|
||||
|
||||
Deprecations
|
||||
|
||||
- The `parser` option is deprecated and should be removed. The built-in Javascript parser is a lot faster than the hiredis parser and has more features
|
||||
|
@@ -1,8 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
// Using a predefined object with this prototype is faster than calling `Object.create(null)` directly
|
||||
// This is needed to make sure `__proto__` and similar reserved words can be used
|
||||
function RawObject () {}
|
||||
RawObject.prototype = Object.create(null);
|
||||
|
||||
module.exports = RawObject;
|
@@ -1,7 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
var RawObject = require('./rawObject');
|
||||
|
||||
// hgetall converts its replies to an Object. If the reply is empty, null is returned.
|
||||
// These function are only called with internal data and have therefore always the same instanceof X
|
||||
function replyToObject (reply) {
|
||||
@@ -9,7 +7,7 @@ function replyToObject (reply) {
|
||||
if (reply.length === 0 || !(reply instanceof Array)) {
|
||||
return null;
|
||||
}
|
||||
var obj = new RawObject();
|
||||
var obj = {};
|
||||
for (var i = 0; i < reply.length; i += 2) {
|
||||
obj[reply[i].toString('binary')] = reply[i + 1];
|
||||
}
|
||||
|
@@ -22,12 +22,10 @@ describe("The 'hgetall' method", function () {
|
||||
});
|
||||
|
||||
it('handles simple keys and values', function (done) {
|
||||
client.hmset(['hosts', '__proto__', '1', 'another', '23', 'home', '1234'], helper.isString('OK'));
|
||||
client.hmset(['hosts', 'hasOwnProperty', '1', 'another', '23', 'home', '1234'], helper.isString('OK'));
|
||||
client.HGETALL(['hosts'], function (err, obj) {
|
||||
if (!/^v0\.10/.test(process.version)) {
|
||||
assert.strictEqual(3, Object.keys(obj).length);
|
||||
assert.strictEqual('1', obj.__proto__.toString()); // eslint-disable-line no-proto
|
||||
}
|
||||
assert.strictEqual(3, Object.keys(obj).length);
|
||||
assert.strictEqual('1', obj.hasOwnProperty.toString());
|
||||
assert.strictEqual('23', obj.another.toString());
|
||||
assert.strictEqual('1234', obj.home.toString());
|
||||
done(err);
|
||||
|
@@ -204,8 +204,8 @@ describe('publish/subscribe', function () {
|
||||
|
||||
it('subscribe; close; resubscribe with prototype inherited property names', function (done) {
|
||||
var count = 0;
|
||||
var channels = ['__proto__', 'channel 2'];
|
||||
var msg = ['hi from channel __proto__', 'hi from channel 2'];
|
||||
var channels = ['channel 1', 'channel 2'];
|
||||
var msg = ['hi from channel 1', 'hi from channel 2'];
|
||||
|
||||
sub.on('message', function (channel, message) {
|
||||
var n = Math.max(count - 1, 0);
|
||||
|
Reference in New Issue
Block a user