Leonidas-from-XIV/node-xml2js — pull request #101 by hoelzl (2013-10-30 00:33:44+00:00)
Title: Improve consistency when explicitArray + mergeAttrs are both true

This patch changes the parser so that nodes introduced by attributes are put into arrays when the `explicitArray` and `mergeAttrs` options are both set.

Previously, only nodes introduced by child elements were wrapped as singleton arrays, nodes introduced by attributes were plain strings even when `explicitArray` was true. Therefore, attributes and child nodes could be treated as equivalent when `explicitArray` was false, but not when `explicitArray` was true.

It's not clear to me whether this was the intended behavior since the tests used `assert.equal` which cannot distinguish the two relevant cases (since it coerces between them). I've therefore also modified the test suite to use `assert.strictEqual`.

The patch also changes the behavior for repeated attributes, but since these are not allowed in well-formed XML, I don't think this should be a problem.