1
0
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:
Salakar
2020-02-07 00:31:08 +00:00
parent 13ec6afe58
commit 9d65e1c3ed
3 changed files with 8 additions and 34 deletions

View File

@@ -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
});
}
};