We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
attributeNameFn
Provide an attributeNameFn, where the second argument is an attributeValue as per the docs. For example:
attributeValue
xml2js(`<root><element attr="val">content</element></root>`, { attributeNameFn: (attributeName, attributeValue, parentElement) => { console.log({ attributeValue }); return attributeName; }, });
The received attributeValue argument is the value of the current attribute.
In the above example the expected result is logging { attributeValue: 'val' }.
{ attributeValue: 'val' }
The received attributeValue argument in the attributeNameFn is undefined.
undefined
Looks like it's being caused by:
xml-js/lib/xml2js.js
Lines 150 to 154 in f0376f2
Notice the value is being deleted before being passed into the function as the second argument. So passing temp here looks like it'd solve the issue.
temp
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Repro steps:
Provide an
attributeNameFn
, where the second argument is anattributeValue
as per the docs. For example:Expected result
The received
attributeValue
argument is the value of the current attribute.In the above example the expected result is logging
{ attributeValue: 'val' }
.Actual result
The received
attributeValue
argument in theattributeNameFn
isundefined
.Further details
Looks like it's being caused by:
xml-js/lib/xml2js.js
Lines 150 to 154 in f0376f2
Notice the value is being deleted before being passed into the function as the second argument. So passing
temp
here looks like it'd solve the issue.The text was updated successfully, but these errors were encountered: