Skip to content

Commit

Permalink
refactor: rename functions, replace console.log with error
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-koval committed Mar 19, 2018
1 parent 61861c7 commit 65ce553
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const getReposList = Promise.method(() => {
return reposList;
})
.catch((err) => {
console.log({ err }, 'getReposList: Error during getting repos list');
console.error({ err }, 'getReposList: Error during getting repos list');
});
});

Expand Down Expand Up @@ -120,27 +120,25 @@ const getDependecyDescriptions = (data) => {

const groupByProjectName = projects => groupBy(project => project.depName)(projects);

const alterDeps = deps => Object.keys(deps).map((key) => {
// console.log('DEPS[KEY]', JSON.stringify(deps[key], null, 2))
const t = deps[key].map(p => {
const {
projectName: name,
projectVersion: version,
projectDescription: description,
} = p;
return {
name,
version,
description
};
});
const remapGroupedDeps = deps => Object.keys(deps).map((key) => {
return {
name: key,
description: deps[key][0].depDescription,
currentVersion: deps[key][0].depCurrentVersion,
homepage: deps[key][0].depHomepage,
license: deps[key][0].depLicense,
projects: t
projects: deps[key].map(p => {
const {
projectName: name,
projectVersion: version,
projectDescription: description,
} = p;
return {
name,
version,
description
};
});
};
});

Expand All @@ -153,5 +151,5 @@ return getReposList()
.map(getDependecyDescriptions)
.then(flatten)
.then(groupByProjectName)
.then(alterDeps)
.then(remapGroupedDeps)
.catch(console.error);

0 comments on commit 65ce553

Please sign in to comment.