filtering collections from convertedSpec

This commit is contained in:
Dhroov7
2019-12-10 13:02:26 +05:30
parent 08c3136370
commit fcd54b1380
2 changed files with 17 additions and 6 deletions

View File

@@ -67,13 +67,24 @@ module.exports = {
_.forEach(convertedSpecs, (convertedSpec) => {
if (convertedSpec.result) {
conversionResult = convertedSpec.result;
convertedCollections.push(convertedSpec.output[0]);
let result;
conversionResult = conversionResult || convertedSpec.result;
function returnCollections (resultSpec) {
if (resultSpec.type === 'collection') {
return true;
}
}
// filtering out the collections from the convertedSpec
result = convertedSpec.output.filter(returnCollections);
result.forEach((collection) => {
convertedCollections.push(collection);
});
}
else {
conversionResult = convertedSpec.result;
conversionResult = conversionResult || convertedSpec.result;
reasonForFail = convertedSpec.reason;
return false; // it will break out from the loop
}
});