From 29ae4d89e6b14c22369f2e37213b2fa2a4ab10c1 Mon Sep 17 00:00:00 2001 From: Daniel Wahlqvist Date: Mon, 16 Jan 2017 11:34:31 +0100 Subject: [PATCH] fix to not convert arrays to objects Arrays are converted to objects. That's a bug. This should fix it --- src/helper/object.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/helper/object.js b/src/helper/object.js index 758849e0..bc2398f9 100644 --- a/src/helper/object.js +++ b/src/helper/object.js @@ -87,6 +87,10 @@ function toSnakeCase(object, exceptions) { function toCamelCase(object, exceptions) { exceptions = exceptions || []; + if (object instanceof Array) { + return object.map(function(obj) { return toCamelCase(obj); }); + } + return Object.keys(object).reduce(function (p, key) { var newKey = exceptions.indexOf(key) === -1 ? snakeToCamel(key) : key; p[newKey] = typeof(object[key]) === 'object' ? toCamelCase(object[key]) : object[key];