Skip to content

Commit

Permalink
if array has "properties" then after filtration cast returned object …
Browse files Browse the repository at this point in the history
…to array
  • Loading branch information
Jokero committed Oct 8, 2015
1 parent f406684 commit 401b3f5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/plugins/filter/filterObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ module.exports = function filterObject(object, config, path, originalObject, opt
}

if (propertyConfig.properties instanceof Object && filteredObject[propertyName] instanceof Object) {
filteredObject[propertyName] = filterObject(filteredObject[propertyName], propertyConfig.properties, propertyPath, originalObject, options);
var filterResult = filterObject(filteredObject[propertyName], propertyConfig.properties, propertyPath, originalObject, options);

if (filteredObject[propertyName] instanceof Array) {
filteredObject[propertyName] = _.values(filterResult);
} else {
filteredObject[propertyName] = filterResult;
}
} else if (propertyConfig.items instanceof Object && filteredObject[propertyName] instanceof Array) {
var arrayConfig = {};
filteredObject[propertyName].forEach(function(item, index) {
Expand Down

0 comments on commit 401b3f5

Please sign in to comment.