diff --git a/index.js b/index.js index 406c8c817f..3f6fa1df6e 100644 --- a/index.js +++ b/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; diff --git a/lib/utils.js b/lib/utils.js index fafffdac7f..bc685b9a4f 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -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; } diff --git a/test/utils.spec.js b/test/utils.spec.js index 094640066b..f6fa8d4e7d 100644 --- a/test/utils.spec.js +++ b/test/utils.spec.js @@ -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,