1
0
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:
Ruben Bridgewater
2016-05-27 16:51:43 +02:00
parent a90b791295
commit 899f9b7fe4
3 changed files with 6 additions and 6 deletions

View File

@@ -1042,7 +1042,7 @@ Object.defineProperty(RedisClient.prototype, 'offline_queue_length', {
}); });
// Add support for camelCase by adding read only properties to the client // 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', { Object.defineProperty(RedisClient.prototype, 'retryDelay', {
get: function () { get: function () {
return this.retry_delay; return this.retry_delay;

View File

@@ -57,14 +57,14 @@ function clone (obj) {
var elems = Object.keys(obj); var elems = Object.keys(obj);
var elem; var elem;
while (elem = elems.pop()) { while (elem = elems.pop()) {
// Accept camelCase options and convert them to snack_case // Accept camelCase options and convert them to snake_case
var snack_case = elem.replace(/[A-Z][^A-Z]/g, '_$&').toLowerCase(); 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 // 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 // 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; camelCase = true;
} }
copy[snack_case] = clone(obj[elem]); copy[snake_case] = clone(obj[elem]);
} }
return copy; return copy;
} }

View File

@@ -29,7 +29,7 @@ describe('utils.js', function () {
assert.strictEqual(Object.keys(b).length, 0); 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({ var a = utils.clone({
optionOneTwo: true, optionOneTwo: true,
retryStrategy: false, retryStrategy: false,