From acc23be2976f7f26bdb6fe732b58422ff75713ea Mon Sep 17 00:00:00 2001 From: Tom Hunkapiller Date: Sat, 22 May 2021 03:47:10 +0300 Subject: [PATCH] remove unnecessary function expression in prepForXml --- src/file/xml-components/xml-component.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/file/xml-components/xml-component.ts b/src/file/xml-components/xml-component.ts index e4176a3a91..f1e76aa797 100644 --- a/src/file/xml-components/xml-component.ts +++ b/src/file/xml-components/xml-component.ts @@ -23,13 +23,11 @@ export abstract class XmlComponent extends BaseXmlComponent { .filter((comp) => comp !== undefined); // Exclude undefined // If we only have a single IXmlableObject in our children array and it // represents our attributes, use the object itself as our children to - // avoid an unneeded XML close element. (Note: We have to use this - // function to get typescript to allow our check.) + // avoid an unneeded XML close element. // Additionally, if the array is empty, use an empty object as our // children in order to get an empty XML element generated. - const onlyAttrs = (c) => typeof c === "object" && c._attr; return { - [this.rootKey]: children.length ? (children.length === 1 && onlyAttrs(children[0]) ? children[0] : children) : EMPTY_OBJECT, + [this.rootKey]: children.length ? (children.length === 1 && children[0]?._attr ? children[0] : children) : EMPTY_OBJECT, }; }