Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bank-codes

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bank-codes

An extraction facility for https://bank.codes

  • 1.3.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Bank Codes

A package that allows the caller to extrace SWIFT codes published by the http://bank.codes service

Install

Add to your project from the NPM repository:

npm install bank-codes --save

and grab an instance:

// using ES6  modules
import bc from 'bank-codes';

// using CommonJS modules
const bc = require('bank-codes');

Usage

The methods in this package store the data retrieved into a cache.json file. This package contains such a file and most clients will simply want to use it directly, rather than scanning the site for the data. The file may be included like this:

const bc = require('bank-codes/cache.json')

The following methods are available in the package:

countries()

Returns an object keyed by country names and values a path within the site see a list of banks

{
    "United States": "/swift-code/united-states/"
}

banks(country)

Retrieves the list of banks for the given country. The return value is similar that below:

[
    {
        "Name": "1ST PMF BANCORP",
        "City": "LOS ANGELES",
        "Branch": "",
        "SWIFT": "PMFAUS66HKG"
    }
]

Examples

The methods return promises so their return values need to be waited for

// as a promise
bc.banks('United States').then(console.log);

// async/await
(async () => {
    console.log(await bc.banks('United States'));
})()

Notes

The cache file produced when calling package methods may become stale across time and can be regenerated by running:

npm run cache

Additionally, country lists of banks can be generated on the command line by adding the country names to the command (titlecased) e.g.

npm run cache Mexico Sweden 

will output progress information to stderr and the output to stdout so it can be captured:

npm run cache Mexico > Mexico.json

Contribute

If you add functionality, make sure tests pass:

npm test

and when publishing, bump up the version like this:

npm version <patch|minor|major>

Licence

ISC

Support

For support post an issue on Github or reach out to me directly @ekkis on Telegram

Keywords

FAQs

Package last updated on 02 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc