From 7b9122d0ddd9741b744070b71c6681f71fe27564 Mon Sep 17 00:00:00 2001 From: Heikki Hellgren Date: Thu, 29 Feb 2024 09:09:14 +0200 Subject: [PATCH] fix: undefined group in final results this closes #27 --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 31f0dc8..024e057 100644 --- a/src/index.ts +++ b/src/index.ts @@ -165,7 +165,7 @@ async function analyse(input?: string | string[], opts: T.Options = {}): Promise } // Set parent to result group if it is present // Is nullish if either `opts.childLanguages` is set or if there is no group - const finalResult = !opts.childLanguages && result && langData[result].group || result; + const finalResult = !opts.childLanguages && result && langData[result] && langData[result].group || result; if (!fileAssociations[file].includes(finalResult)) fileAssociations[file].push(finalResult); extensions[file] = paths.extname(file).toLowerCase();