Roadmap to becoming a developer in 2022
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

34 lines
798 B

import guides from 'storage/guides';
import authors from 'storage/authors';
import siteConfig from 'storage/site';
export const getAllGuides = () => {
return guides.filter(guide => !guide.draft)
.sort((a, b) => new Date(b.updatedAt) - new Date(a.updatedAt));
};
export const getFeaturedGuides = () => {
return getAllGuides().filter(guide => guide.featured);
};
export const getRequestedGuide = req => {
const guide = guides.find(guide => guide.url === req.url);
if (!guide) {
return null;
}
try {
return {
...guide,
author: authors.find(author => author.username === guide.author) || {},
};
} catch (e) {
console.log(e);
}
return null;
};
export const getContributionUrl = (guide) => {
return `${siteConfig.url.repoData}${guide.url}.md`
};