Skip to content

Commit 032ebc2

Browse files
committed
refactor BpmnXmlParser.ts: first check the string type, for simplicity and make sonarcloud happy
1 parent af94e12 commit 032ebc2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/component/parser/xml/BpmnXmlParser.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ export default class BpmnXmlParser {
7575

7676
// See https://github.com/NaturalIntelligence/fast-xml-parser/blob/v5.5.7/docs/v4%2C%20v5/2.XMLparseOptions.md#attributevalueprocessor
7777
attributeValueProcessor: (attributeName: string, attributeValue: string, nodePathOrMatcher: unknown): unknown => {
78-
// nodePathOrMatcher is a Matcher instance (jPath: false). Get path without namespace prefixes.
78+
// nodePathOrMatcher is a Matcher instance (jPath: false) or a string (jPath: true). Get path without namespace prefixes.
7979
const nodePath =
80-
typeof nodePathOrMatcher === 'object' && nodePathOrMatcher !== null
81-
? String((nodePathOrMatcher as { toString(separator?: string, includeNs?: boolean): string }).toString('.', false))
82-
: String(nodePathOrMatcher);
80+
typeof nodePathOrMatcher === 'string'
81+
? nodePathOrMatcher
82+
: (nodePathOrMatcher as { toString(separator?: string, includeNs?: boolean): string }).toString('.', false);
8383

8484
if (isNumeric(attributeName, nodePath)) {
8585
// The strnum lib used by fast-xml-parser is not able to parse all numbers

0 commit comments

Comments
 (0)