Skip to content

Commit

Permalink
feat: Add filterJson function to main program
Browse files Browse the repository at this point in the history
  • Loading branch information
RSeidelsohn committed Feb 3, 2022
1 parent 124ec3a commit c02e181
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions bin/license-checker-rseidelsohn
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,21 @@ function colorizeOutput(json) {
});
}

function filterJson(limitAttributes, json) {
let filteredJson = json;

if (limitAttributes) {
filteredJson = {};
const attributes = limitAttributes.split(',').map((attribute) => attribute.trim());

Object.keys(json).forEach((dependency) => {
filteredJson[dependency] = licenseChecker.filterAttributes(attributes, json[dependency]);
});
}

return filteredJson;
}

function getFormattedOutput(json, args) {
const jsonCopy = cloneDeep(json);

Expand Down

0 comments on commit c02e181

Please sign in to comment.