You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Fix hungry developer typo
This commit is contained in:
2
index.js
2
index.js
@@ -1042,7 +1042,7 @@ Object.defineProperty(RedisClient.prototype, 'offline_queue_length', {
|
||||
});
|
||||
|
||||
// Add support for camelCase by adding read only properties to the client
|
||||
// All known exposed snack_case variables are added here
|
||||
// All known exposed snake_case variables are added here
|
||||
Object.defineProperty(RedisClient.prototype, 'retryDelay', {
|
||||
get: function () {
|
||||
return this.retry_delay;
|
||||
|
@@ -57,14 +57,14 @@ function clone (obj) {
|
||||
var elems = Object.keys(obj);
|
||||
var elem;
|
||||
while (elem = elems.pop()) {
|
||||
// Accept camelCase options and convert them to snack_case
|
||||
var snack_case = elem.replace(/[A-Z][^A-Z]/g, '_$&').toLowerCase();
|
||||
// Accept camelCase options and convert them to snake_case
|
||||
var snake_case = elem.replace(/[A-Z][^A-Z]/g, '_$&').toLowerCase();
|
||||
// If camelCase is detected, pass it to the client, so all variables are going to be camelCased
|
||||
// There are no deep nested options objects yet, but let's handle this future proof
|
||||
if (snack_case !== elem.toLowerCase()) {
|
||||
if (snake_case !== elem.toLowerCase()) {
|
||||
camelCase = true;
|
||||
}
|
||||
copy[snack_case] = clone(obj[elem]);
|
||||
copy[snake_case] = clone(obj[elem]);
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ describe('utils.js', function () {
|
||||
assert.strictEqual(Object.keys(b).length, 0);
|
||||
});
|
||||
|
||||
it('transform camelCase options to snack_case and add the camel_case option', function () {
|
||||
it('transform camelCase options to snake_case and add the camel_case option', function () {
|
||||
var a = utils.clone({
|
||||
optionOneTwo: true,
|
||||
retryStrategy: false,
|
||||
|
Reference in New Issue
Block a user