Skip to content

Commit

Permalink
Added opportunities to json format
Browse files Browse the repository at this point in the history
  • Loading branch information
JuanMaRuiz committed Mar 19, 2019
1 parent 786bebd commit 90e4d79
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/formats/json.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
'use strict';
const _ = require('lodash');

module.exports = (overview, statistics, ruleSetResults) => {
module.exports = (overview, statistics, ruleSetResults, opportunities) => {
const mapSection = section => section.label;
const zip = (section, labelMapping) => _.zipObject(_.map(section, labelMapping), _.map(section, 'value'));

overview = zip(overview, 'label');
statistics = zip(statistics, mapSection);
ruleSetResults = zip(ruleSetResults, mapSection);
opportunities = zip(opportunities, mapSection);

return JSON.stringify({
overview,
statistics,
ruleResults: ruleSetResults
ruleResults: ruleSetResults,
opportunities: opportunities
}, null, 2);
};

0 comments on commit 90e4d79

Please sign in to comment.