Skip to content

Add structured append support to JS/TS#242

Open
popod wants to merge 1 commit into
nayuki:masterfrom
popod:patch-1
Open

Add structured append support to JS/TS#242
popod wants to merge 1 commit into
nayuki:masterfrom
popod:patch-1

Conversation

@popod

@popod popod commented Jul 4, 2026

Copy link
Copy Markdown

Allows to generate structured append QR code with the JS/TS lib.

To simplify : data splitting and parity check are done externally.

Only SA header values are passed to this module with the structuredAppend option.

Linked to #195

Copilot AI review requested due to automatic review settings July 4, 2026 15:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds structured append (SA) header support to the TypeScript/JavaScript QR generation API by allowing callers to supply SA header values via a new structuredAppend option when encoding segments.

Changes:

  • Extends QrCode.encodeSegments() with an optional structuredAppend parameter (index/total/parity).
  • Accounts for the SA header bit length during version/capacity selection.
  • Prepends the SA mode header bits to the bit buffer before segment encoding.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +96 to +101
if (structuredAppend !== undefined) {
if (structuredAppend.total < 1 || structuredAppend.total > 16
|| structuredAppend.index < 0 || structuredAppend.index >= structuredAppend.total
|| structuredAppend.parity >>> 8 !== 0)
throw new RangeError("Invalid structured append values");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants