Use nullish conversion for packs
Slightly simplifies the `parsePacks` function.
This commit is contained in:
parent
49b2220f92
commit
96e7de35af
3 changed files with 9 additions and 11 deletions
|
|
@ -999,7 +999,11 @@ async function loadConfig(
|
|||
}
|
||||
}
|
||||
|
||||
const packs = parsePacks(parsedYAML[PACKS_PROPERTY], languages, configFile);
|
||||
const packs = parsePacks(
|
||||
parsedYAML[PACKS_PROPERTY] ?? {},
|
||||
languages,
|
||||
configFile
|
||||
);
|
||||
|
||||
return {
|
||||
languages,
|
||||
|
|
@ -1029,16 +1033,12 @@ const PACK_IDENTIFIER_PATTERN = (function () {
|
|||
|
||||
// Exported for testing
|
||||
export function parsePacks(
|
||||
packsByLanguage: string[] | Record<string, string[]> | undefined,
|
||||
packsByLanguage: string[] | Record<string, string[]>,
|
||||
languages: Language[],
|
||||
configFile: string
|
||||
): Packs {
|
||||
const packs = {};
|
||||
|
||||
if (!packsByLanguage) {
|
||||
return packs;
|
||||
}
|
||||
|
||||
if (Array.isArray(packsByLanguage)) {
|
||||
if (languages.length === 1) {
|
||||
// single language analysis, so language is implicit
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue