You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-09 00:22:08 +03:00
tests: fix buffer test (failed due to new parser) & remove unused node feature checks (< 4)
This commit is contained in:
@@ -4,18 +4,6 @@ var commands = require('redis-commands');
|
||||
var Multi = require('./multi');
|
||||
var RedisClient = require('../').RedisClient;
|
||||
var Command = require('./command');
|
||||
// Feature detect if a function may change it's name
|
||||
var changeFunctionName = (function () {
|
||||
var fn = function abc () {};
|
||||
try {
|
||||
Object.defineProperty(fn, 'name', {
|
||||
value: 'foobar'
|
||||
});
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}());
|
||||
|
||||
var addCommand = function (command) {
|
||||
// Some rare Redis commands use special characters in their command name
|
||||
@@ -61,11 +49,9 @@ var addCommand = function (command) {
|
||||
if (commandName !== command) {
|
||||
RedisClient.prototype[commandName.toUpperCase()] = RedisClient.prototype[commandName] = RedisClient.prototype[command];
|
||||
}
|
||||
if (changeFunctionName) {
|
||||
Object.defineProperty(RedisClient.prototype[command], 'name', {
|
||||
value: commandName
|
||||
});
|
||||
}
|
||||
Object.defineProperty(RedisClient.prototype[command], 'name', {
|
||||
value: commandName
|
||||
});
|
||||
}
|
||||
|
||||
// Do not override existing functions
|
||||
@@ -108,11 +94,9 @@ var addCommand = function (command) {
|
||||
if (commandName !== command) {
|
||||
Multi.prototype[commandName.toUpperCase()] = Multi.prototype[commandName] = Multi.prototype[command];
|
||||
}
|
||||
if (changeFunctionName) {
|
||||
Object.defineProperty(Multi.prototype[command], 'name', {
|
||||
value: commandName
|
||||
});
|
||||
}
|
||||
Object.defineProperty(Multi.prototype[command], 'name', {
|
||||
value: commandName
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user