Skip to content

opendevtools/rescript-clearingnummer

Repository files navigation

Clearingnummer

npm (scoped)

Sort codes, clearingnummer in Swedish, are four or five digit identifiers for Swedish banks. This package helps you find the bank related to a specific number. All clearing numbers are taken from Wikipedia and Swedish Bankers Association.

This is a semi-port of my JavaScript library Clearingnummer written completely in Reason.

Installation

npm install @opendevtools/rescript-clearingnummer

Add @opendevtools/rescript-clearingnummer to bs-dependencies in bsconfig.json

Modules

BankName

fromInt

Takes a clearing number as int. This is the most common format.

(* int => string *)
let bankName = Clearingnummer.BankName.fromInt(5202)
(* bankName = "SEB" *)

fromString

Used by Swedbank and their old bank names (sparbanker)

(* string => string *)
let bankName = Clearingnummer.BankName.fromString("8060-6")
(* bankName = "Swedbank" *)

Banks

all

(* array(string) *)
let banks = Clearingnummer.Banks.all
(* banks = ["Amfa Bank", "Avanza Bank", ...] *)

Tests

Build JavaScript files first using npm run build or npm run start

$ npm test