Skip to content

Commit

Permalink
Fix compacting arrays when nested
Browse files Browse the repository at this point in the history
  • Loading branch information
tdzienniak committed Feb 2, 2016
1 parent c8857a0 commit 5c10cee
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ exports.compact = function (obj, references) {
var compacted = [];

for (var i = 0; i < obj.length; ++i) {
if (typeof obj[i] !== 'undefined') {
if (Object.prototype.toString.call(obj[i]) === '[object Object]') {
compacted.push(exports.compact(obj[i], refs));
} else if (typeof obj[i] !== 'undefined') {
compacted.push(obj[i]);
}
}
Expand Down

0 comments on commit 5c10cee

Please sign in to comment.