Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return _.flatten(languages.map((language) => {
// Filter posts by language considering. Posts without a language is considered of the default language.
const posts = locals.posts.filter(postFilter(language));
if (posts.length === 0) {
return null;
}
const routes = archiveGenerator.call(this, Object.assign({}, locals, {
posts: posts
}));
if (isDefaultLanguage(language)) {
return routes;
}
return routes.map(route => {
const data = Object.assign({}, route.data, {
base: pathJoin(language, route.data.base),
current_url: pathJoin(language, route.data.current_url)
});
return Object.assign({}, route, {
path: pathJoin(language, route.path),
data: data
});
});
}).filter(post => post !== null));