Skip to content

Commit

Permalink
Bug fixes for profile-less nownownow users
Browse files Browse the repository at this point in the history
  • Loading branch information
haroldtreen committed Jul 14, 2016
1 parent f2e667e commit 7f6981f
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ const getProfilesList = () => {
.attr('href'),
description: $(el).find('.subtitle').text(),
};
profiles.push(profile);
if (profile.path) {
profiles.push(profile);
}
});
return Promise.resolve(profiles);
});
Expand All @@ -68,7 +70,7 @@ const getProfile = (path) => {
})
.catch(() => {
profileDownloadBar.tick();
Promise.resolve({});
return Promise.resolve({});
});
};

Expand All @@ -94,12 +96,8 @@ const getProfiles = (profilesList) => {
const lessProfiles = limitProfiles(profilesList);
profileDownloadBar = new ProgressBar('[:bar] :percent', { total: lessProfiles.length });

const profilePromises = lessProfiles.map((profile) => {
if (profile.path) {
return getProfile(profile.path);
}
return Promise.resolve({});
});
const profilePromises = lessProfiles.map((profile) => getProfile(profile.path));

return Promise.all(profilePromises);
};

Expand All @@ -109,7 +107,7 @@ const openProfiles = (queries) => {
.then((profiles) => {
const matchedProfiles = filterProfiles(queries, profiles);
matchedProfiles.forEach((matchedProfile) => openurl.open(matchedProfile.url));
console.log('Done!');
console.log(`\nDone - ${matchedProfiles.length} profiles found.`);
})
.catch((error) => {
console.log(error);
Expand Down

0 comments on commit 7f6981f

Please sign in to comment.