Leonidas-from-XIV / node-xml2js

XML to JavaScript object converter.
MIT License
4.84k stars 598 forks source link

Fix trim option for empty tags #643

Open AHarman opened 2 years ago

AHarman commented 2 years ago

Previously, this test would fail:

'test trimming on empty tag with whitespace': skeleton(trim: true, (r) ->
    equ r.sample.emptytestanother[0], '')

where "emptytestanother" looked like this:

    <emptytestanother>

    </emptytestanother>

The value was coming back as \n \n (the whitespace between the tags).

Leonidas-from-XIV commented 2 years ago

Can you add the test and implement the fix in the CoffeeScript source code?

AHarman commented 2 years ago

Sorry about that! Committed the wrong files.

I've fixed that and pushed the right changes.