npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

nz-bank-parser

v1.0.0

Published

Zero-dependency TypeScript parser for CSV exports from New Zealand banks (ANZ, ASB, Westpac, Kiwibank), normalising them into a single transaction format.

Downloads

183

Readme

CI codecov license: MIT npm version

nz-bank-parser — one clean transaction format for NZ bank CSV exports

Live Playground · Documentation · Report Bug

Playground demo: loading bank samples and seeing normalised transactions

Why this exists

Every New Zealand bank exports transaction CSVs in its own dialect: different date formats, different column names, different sign conventions. Anyone building a budgeting tool, expense splitter or accounting import ends up rewriting the same brittle parsing code. This library does it once, properly, with zero dependencies.

Features

  • Parses CSV exports from ANZ, ASB, Westpac and Kiwibank
  • Auto-detects the bank from header fingerprints, or accepts an explicit bank option
  • Normalises everything to one model: ISO dates, amounts in cents, explicit debit/credit direction
  • Never throws away a whole file: bad rows are collected as structured errors, good rows still parse
  • Handles BOM, quoted commas, CRLF, empty lines, negative signs and parenthesised amounts
  • Zero runtime dependencies, dual ESM/CJS, full TypeScript types

Format support

| Bank | Export | Header verified against | Dates | Balance column | | -------- | -------------------------------------------- | ------------------------------------------------- | ---------- | -------------- | | ANZ | Internet Banking transaction history CSV | ANZ help pages and independent tooling docs | DD/MM/YYYY | No | | ASB | FastNet Classic CSV (with metadata preamble) | Accounting software import guides | YYYY/MM/DD | No | | Westpac | Online banking CSV | Westpac published export documentation | DD/MM/YYYY | No | | Kiwibank | Full CSV | Accounting import guides only (no published spec) | DD-MM-YYYY | Yes |

Detection is fingerprint-based on the header row. If your bank changes its export and detection fails, pass { bank: '...' } explicitly and open an issue with the new header row.

Architecture

flowchart LR
    A[CSV text] --> B[Tokenizer]
    B --> C{Bank detection}
    C -->|header fingerprint| D[Bank adapter]
    D --> E[Normalisers: date, amount, direction]
    E --> F[ParseResult: transactions + row errors]

Tech Stack

TypeScript (strict), tsup (ESM + CJS), Vitest, GitHub Actions, semantic-release. Playground: Vite, React, Tailwind CSS.

Getting Started

npm install nz-bank-parser
import { parse } from 'nz-bank-parser';

const result = parse(csvContent); // bank auto-detected
// or: parse(csvContent, { bank: 'anz' })

for (const tx of result.transactions) {
  console.log(tx.date, tx.direction, tx.amount, tx.description);
}
console.log(result.errors); // rows that could not be parsed, with reasons

Testing

npm test               # unit tests
npm run test:coverage  # with coverage report (threshold: 90 percent)

All fixtures are synthetic. No real bank statements are used anywhere in this repository.

Roadmap

See ROADMAP.md.

License

MIT