node-xml2js
node-xml2js copied to clipboard
new builder options: tagNameProcessors and attrNameProcessors
- Added tag and attribute name processing to the builder (similar to what the parser does)
- Added tests for tag and attribute name processing for the builder (similar to the tests for the parser)
- Minor refactoring in parser.coffee:
processItem
was always used in the same way, removed some copied code - Added
package-lock.json
to.gitignore
to make git handling simpler. (If you want, we can revert this.) - Added a TODO to the line
for key, entry of child
inbuilder.coffee
- should it befor own key...
? - Updated
README.md
. - Note: We could also try to add value processors, but I'd rather do that in a separate PR.
Potential issues:
- Backwards compatibility: Some users may have used the same options object for the parser and the builder in their code. Until now, this worked, because the builder simply ignored
tagNameProcessors
andattrNameProcessors
. After this pull request, such users may run into problems because their builder modifies the names in unexpected ways. Possible remedies:- Change the names of the builder options, e.g.
builderTagNameProcessors
andbuilderAttrNameProcessors
.- Rather ugly, I think. In the long run, this will be confusing rather than helpful.
- Add another option that activates
tagNameProcessors
andattrNameProcessors
in the builder, e.g.builderProcessors: true
orversion: "0.4.20"
. Old code doesn't contain this option and thus works as usual.- Workable, but maybe users will expect all options to be "versioned" in this way...
- Simply update the documentation and instruct users not to use the same options object for parser and builder. (With object spread syntax (available since Node.js 8.3.0), it's easy to have a common base options object and extend it with different options for builder and parser.)
- In my opinion, this is the best solution, so I added a few sentences to
README.md
- In my opinion, this is the best solution, so I added a few sentences to
- Change the names of the builder options, e.g.
Coverage increased (+0.07%) to 97.708% when pulling b0277eb70228b863655ca0f654baf52ac0205872 on iami-me:add_prop_name_processors into 049242dbefc2d69e8e8ceac566b9e862a58c9ff1 on Leonidas-from-XIV:master.
Hello guys, when will this be implemented? Thank you 😀