Skip to content

Commit

Permalink
Remove array check on variable that is always array
Browse files Browse the repository at this point in the history
  • Loading branch information
bobd91 committed Mar 11, 2018
1 parent 057229c commit 65301af
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions lib/plugins/filter/template_locals/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ function i18nLocalsFilter(locals) {
lang = data.lang;
page.canonical_path = data.path;
} else {
lang = getFirstLanguage(i18nConfigLanguages);
// i18n.languages is always an array with at least one argument ('default')
lang = i18nConfigLanguages[0];
}

page.lang = lang;
Expand All @@ -36,11 +37,3 @@ function i18nLocalsFilter(locals) {
}

module.exports = i18nLocalsFilter;

function getFirstLanguage(lang) {
if (Array.isArray(lang)) {
return lang[0];
}

return lang;
}

0 comments on commit 65301af

Please sign in to comment.