From a6dcf4dfce0d113fcafcdb00c8edbf5cfafc282d Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Mon, 3 Jul 2023 18:20:20 -0500 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Marc Durdin --- common/web/types/src/kmx/element-string.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/common/web/types/src/kmx/element-string.ts b/common/web/types/src/kmx/element-string.ts index c3e0298eb9..9be6df2e2d 100644 --- a/common/web/types/src/kmx/element-string.ts +++ b/common/web/types/src/kmx/element-string.ts @@ -29,7 +29,7 @@ export class ElemElement { export class ElementString extends Array { /** * @param source if a string array, does not get reinterpreted as UnicodeSet. This is used with vars, etc. Or pass `["str"]` for an explicit 1-element elem. - * If it is a string, will be interpreted per reorder element ruls. + * If it is a string, will be interpreted per reorder element rules. */ constructor(sections: DependencySections, source: string | string[], order?: string, tertiary?: string, tertiary_base?: string, prebase?: string) { super(); @@ -38,9 +38,8 @@ export class ElementString extends Array { return; } - const sourceIsArray = Array.isArray(source); let items : ElementSegment[]; - if (sourceIsArray) { + if (Array.isArray(source)) { items = source.map(segment => new ElementSegment(segment, ElementType.string)); } else { // use segmenter to analyze each part