Skip to content

fix: honor single-character array node names - #27

Open
fhgffy wants to merge 2 commits into
NaturalIntelligence:mainfrom
fhgffy:fix-single-character-array-node-20261011
Open

fhgffy wants to merge 2 commits into
NaturalIntelligence:mainfrom
fhgffy:fix-single-character-array-node-20261011

Conversation

@fhgffy

@fhgffy fhgffy commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

A top-level array with arrayNodeName: 'x' currently produces numeric tags such as <0>a</0> rather than <x>a</x>. The length check excludes valid one-character XML names.

Accept any non-empty configured name. The regression covers primitive and object array entries, with longer-name and empty-name controls.

Validation:

  • The new regression fails on the base revision for both primitive and object entries.
  • npm test: 138 specs, 0 failures, 1 existing pending spec.
  • npm run bundle: both bundles compile; source ESM and rebuilt CommonJS produce the expected tags.
  • The new spec passes ESLint. Direct source lint reports the same four pre-existing errors as the base revision.

The existing lint script references an absent benchmark directory, and test-types references an absent spec/typings/typings-test.ts.

Comment thread src/fxb.js Outdated
} else {
if (Array.isArray(jObj) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1) {
// 2026-10-11: XML names can be a single character.
if (Array.isArray(jObj) && this.options.arrayNodeName && this.options.arrayNodeName.length > 0) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be enough in this case: if (Array.isArray(jObj) && this.options.arrayNodeName) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Couldn't load reviewers.

Assignees

Couldn't load assignees.