Repository: auth0/auth0.js
Pull request #329 (2017-01-23 14:26:25)

Fix case convertion of null values
RE https://github.com/auth0/lock/issues/825

codecov-io: ## [Current coverage](https://codecov.io/gh/auth0/auth0.js/pull/329?src=pr) is 98.82% (diff: 100%)
> Merging [#329](https://codecov.io/gh/auth0/auth0.js/pull/329?src=pr) into [master](https://codecov.io/gh/auth0/auth0.js/branch/master?src=pr) will not change coverage

```diff
@@             master       #329   diff @@
==========================================
  Files            30         30          
  Lines          1023       1023          
  Methods         171        171          
  Messages          0          0          
  Branches        167        167          
==========================================
  Hits           1011       1011          
  Misses           12         12          
  Partials          0          0          
```

> Powered by [Codecov](https://codecov.io?src=pr). Last update [5f97950...783c453](https://codecov.io/gh/auth0/auth0.js/compare/5f979505418f6e01cd7a1c3850981c6e80e51950...783c45355b07ed8b2dc3af218e1446158414459e?src=pr)

Patch:
diff --git a/src/helper/object.js b/src/helper/object.js
index bc6cb97..6a5520d 100644
--- a/src/helper/object.js
+++ b/src/helper/object.js
@@ -88,10 +88,9 @@ function snakeToCamel(str) {
 }
 
 function toSnakeCase(object, exceptions) {
-  if (typeof object !== 'object' || assert.isArray(object) || !object === null) {
+  if (typeof object !== 'object' || assert.isArray(object) || object === null) {
     return object;
   }
-
   exceptions = exceptions || [];
 
   return Object.keys(object).reduce(function (p, key) {
@@ -102,7 +101,7 @@ function toSnakeCase(object, exceptions) {
 }
 
 function toCamelCase(object, exceptions) {
-  if (typeof object !== 'object' || assert.isArray(object) || !object === null) {
+  if (typeof object !== 'object' || assert.isArray(object) || object === null) {
     return object;
   }
 


Test patch:
diff --git a/test/helper/object.test.js b/test/helper/object.test.js
index 794d3cf..0f3ab39 100644
--- a/test/helper/object.test.js
+++ b/test/helper/object.test.js
@@ -371,6 +371,7 @@ describe('helpers', function () {
         attrName1: 'attribute_1',
         attrName22: 'attribute_2',
         attrNAME3: 'attribute_3',
+        attrNULL: null,
         arrayAtt: [ 'one', 'two' ],
         someObj: {
           objAtt1: 'asd',
@@ -385,6 +386,7 @@ describe('helpers', function () {
         attrName1: 'attribute_1',
         attrName22: 'attribute_2',
         attrNAME3: 'attribute_3',
+        attrNULL: null,
         arrayAtt: [ 'one', 'two' ],
         someObj: {
           objAtt1: 'asd',
@@ -400,6 +402,7 @@ describe('helpers', function () {
         attr_name_1: 'attribute_1',
         attr_name_22: 'attribute_2',
         attr_name_3: 'attribute_3',
+        attr_null: null,
         array_att: [ 'one', 'two' ],
         some_obj: {
           obj_att_1: 'asd',
@@ -439,6 +442,7 @@ describe('helpers', function () {
         attr_name_1: 'attribute_1',
         attr_name_22: 'attribute_2',
         attr__name_3: 'attribute_3',
+        attr_null: null,
         arr_att: [ "one", "two" ],
         some_obj: {
           obj_att_1: 'asdf',
@@ -453,6 +457,7 @@ describe('helpers', function () {
         attr_name_1: 'attribute_1',
         attr_name_22: 'attribute_2',
         attr__name_3: 'attribute_3',
+        attr_null: null,
         arr_att: [ "one", "two" ],
         some_obj: {
           obj_att_1: 'asdf',
@@ -468,6 +473,7 @@ describe('helpers', function () {
         attrName1: 'attribute_1',
         attrName22: 'attribute_2',
         attrName3: 'attribute_3',
+        attrNull: null,
         arrAtt: [ "one", "two" ],
         someObj: {
           objAtt1: 'asdf',