-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
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
Internal state (options) can be modified asynchronously #25
Comments
I agree. Push this and I'll test it, update the version, and kick a new On Aug 16, 2016 8:01 PM, "eliseevmikhail" notifications@github.com wrote:
|
I noticed this as well. It looks like subsequent calls to > xml = "<ClockCyclesGalore>CPU's working overtime</ClockCyclesGalore>"
'<ClockCyclesGalore>CPU\'s working overtime</ClockCyclesGalore>'
> parsed1 = xmlToJSON.parseString(xml, { textKey: 'CustomTextKey' })
{ ClockCyclesGalore: [ { CustomTextKey: 'CPU\'s working overtime' } ] }
> parsed2 = xmlToJSON.parseString(xml)
{ ClockCyclesGalore: [ { ShouldBeDifferentKey: 'CPU\'s working overtime' } ] }
> parsed1 = xmlToJSON.parseString(xml, { textKey: 'CustomTextKey' })
{ ClockCyclesGalore: [ { CustomTextKey: 'CPU\'s working overtime' } ] }
> parsed2 = xmlToJSON.parseString(xml)
{ ClockCyclesGalore: [ { CustomTextKey: 'CPU\'s working overtime' } ] } On second call ( I recommend:
I'm happy to submit a PR if you'd like. |
xmlToJSON uses single instance for every call, and every call modifies options object at parseXML function. Is it better to create onetime local copy of options for every call? Like this:
The text was updated successfully, but these errors were encountered: