Skip to content

docs: add usage examples to README and bump to v0.5.1#6

Merged
SimonLoir merged 2 commits intomainfrom
copilot/update-readme-examples
Mar 10, 2026
Merged

docs: add usage examples to README and bump to v0.5.1#6
SimonLoir merged 2 commits intomainfrom
copilot/update-readme-examples

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 10, 2026

README lacked practical usage examples. API Reference only documented one method despite the toolkit exposing invoice/credit note generation, XML parsing, totals computation, and EAS lookup.

README changes

  • Quick Start — stripped placeholder {} examples; replaced with minimal working ESM/CJS imports
  • Usage Examples (new section) — six end-to-end snippets covering:
    • invoiceToPeppolUBL / creditNoteToPeppolUBL with full typed payloads
    • peppolUBLToInvoice / peppolUBLToCreditNote round-trip parsing
    • PeppolToolkit.computeTotals() with multi-rate VAT breakdown
    • PeppolToolkit.getEASFromTaxId() country-prefix → EAS scheme lookup
    • exampleInvoice / exampleCreditNote built-in fixtures
  • API Reference — replaced prose bullets with method/helper tables covering all public surface
  • Roadmap — marked completed items (invoice API, types, validation helpers, CreditNote, docs)

Version

  • package.json: 0.5.00.5.1

Example: compute totals across mixed VAT rates

import { PeppolToolkit } from '@pixeldrive/peppol-toolkit';

const totals = PeppolToolkit.computeTotals([
    { price: 100,   quantity: 10, taxPercent: 21 },
    { price: 49.99, quantity: 3,  taxPercent: 21 },
    { price: 200,   quantity: 2,  taxPercent: 0  },
]);

console.log(totals.baseAmount.toNumber());   // 1549.97
console.log(totals.taxAmount.toNumber());    // 241.49
console.log(totals.totalAmount.toNumber());  // 1791.46

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…0.5.1

Co-authored-by: SimonLoir <17649337+SimonLoir@users.noreply.github.com>
Copilot AI changed the title [WIP] Update README to include usage examples for toolkit docs: add usage examples to README and bump to v0.5.1 Mar 10, 2026
@SimonLoir SimonLoir marked this pull request as ready for review March 10, 2026 23:44
@SimonLoir SimonLoir merged commit feb54cb into main Mar 10, 2026
1 of 2 checks passed
@SimonLoir SimonLoir deleted the copilot/update-readme-examples branch March 10, 2026 23:44
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