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 🙏

© 2024 – Pkg Stats / Ryan Hefner

swedish-bank-account-validator

v2024.1.1

Published

Validation logic for swedish bank accounts according to public bank account format documents

Downloads

34

Readme

Swedish bank account validator

Validation logic for swedish bank accounts according to public bank account format documents

The validation is built around bank information from centralized bank details information from bankgirot.se. The document used as validation logic in this package can be found here: Bank account validation document.

To run and install this package

$ npm install swedish-bank-account-validator

import { accountAndClearingCheck } from 'swedish-bank-account-validator';
const validationObject = accountAndClearingCheck(1234, 123456789);

Functions

  • accountAndClearingCheck takes clearing and account number as input and returns an object with validation information.
{
	name: string | undefined
	hasWarning: boolean
	warningType: string
	clearing: {
		number: string
		valid: boolean
		errorType: string
	},
	account: {
		number: string
		valid: boolean
		errorType: string
	},
}
  • clearingNumberCheck takes clearing number as input and returns an object with validation information.
{
	name: string
	number: string
	valid: boolean
	errorType: string
	hasWarning: boolean
	warningType: string
}
  • accountNumberCheck takes account number as input and returns an object with validation information.
{
	number: string
	valid: boolean
	errorType: string
}
  • getBankDataFromClearingNumber takes clearing number as input and returns an object with bank information user for validation logic.
{
	name: string
	number: string
	valid: boolean
	errorType: string
	hasWarning: boolean
	warningType: string
}

Returned values

there are 2 different kind of validation failures present in the return objects.

Error

The strict validation is if there is an error in the format of either account or clearing number. These are strict and can be considered to determine that the input numbers are not valid. The ErrorType is refering to what kind of formatting error this is.

Warning

The warning is true if the bank account did not match a format provided by the algorithms. A warningType is also provided stating if this is connected to the clearing number, or of it is connected to the whole account (clearing and account number) It is returned as a warning as it might not be 100% accurate.

The only way for the bank account validation to be 100% correct is to use an open banking API. This static bank account check is however very accurate, and most failures in this validation functionalty would be giving a false positive, most frequently occuring with Swedbank since they have a different format in relation to other banks as stated in the validation document.

Other information

Terms of usage (MIT) - Lisence

Basicly feel free to use, fork etc. But The author takes no responsibility of the code as stated in the license.