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

bsb-validate

v1.0.0

Published

Validate, format, decode and look up Australian BSB (Bank State Branch) numbers. Offline validation plus optional lookups via the free BSBFinder API.

Downloads

67

Readme

bsb-validate

Validate, format, decode, and look up Australian BSB (Bank State Branch) numbers in Node.js and the browser.

  • Offline validation — no network call needed to check format
  • 🔎 Full lookups — bank, branch, address and payment capabilities via the free BSBFinder API
  • 🧩 Zero dependencies
  • 📦 TypeScript types included

BSB numbers are the six-digit codes that route domestic bank transfers in Australia. This library helps you validate them before submitting a payment, decode their structure, and fetch full branch details on demand.

Install

npm install bsb-validate

Quick start

const { validateBSB, formatBSB, decodeBSB, lookupBSB } = require('bsb-validate');

// Offline: validate format
validateBSB('062-000');
// → { valid: true, formatted: '062-000' }

validateBSB('62');
// → { valid: false, formatted: null, reason: 'BSB must contain exactly 6 digits' }

// Offline: normalise messy input
formatBSB(' 062 000 ');   // → '062-000'
formatBSB('062000');      // → '062-000'

// Offline: decode the structural parts
decodeBSB('062-000');
// → { formatted: '062-000', bankCode: '06', stateCode: '2', branchCode: '000' }

// Online: full details via the BSBFinder API
const details = await lookupBSB('062-000');
console.log(details.bank, details.branch, details.address);

API

validateBSB(input)

Checks whether a value is a structurally valid BSB (six digits). Works fully offline. Returns { valid, formatted, reason? }.

Note: this validates format, not whether the BSB is currently active in the AusPayNet register. For that, use lookupBSB().

formatBSB(input)

Normalises any 6-digit input ("062000", "062-000", " 062 000 ", 123456) to canonical NNN-NNN form. Returns null if it can't be reduced to six digits.

decodeBSB(input)

Breaks a BSB into its parts: the first two digits (bankCode) identify the institution, the third (stateCode) the state/territory, and the last three (branchCode) the branch. Returns null on invalid input.

lookupBSB(input, options?)

Fetches full details for a BSB from the free BSBFinder API — bank name, branch, address, SWIFT code and payment methods (BECS/NPP). Returns a Promise.

Node 18+ and modern browsers have a global fetch. For older Node, pass one in:

const fetch = require('node-fetch');
const details = await lookupBSB('062-000', { fetch });

Supports an AbortSignal via options.signal.

Data source

Full lookups are powered by BSBFinder.com, a free tool that indexes every active Australian BSB code (sourced from AusPayNet). BSBFinder also offers:

The API is free to use for reasonable volumes and requires no authentication.

License

MIT © Ujwal Jayendran


Built alongside BSBFinder.com — free Australian bank code tools.