naija-banks-branches-sortcode
v1.0.0
Published
Lightweight NPM package for Nigerian banks, branches and sort-codes.
Maintainers
Readme
Nigerian Banks Branches and Sort Codes
Lightweight NPM package for Nigerian banks, branches, and sort codes. This package provides comprehensive data about Nigerian banks including their branches across different states and local government areas.
🏠 Homepage
Features
- ✅ Get all Nigerian banks with their sort codes and USSD codes
- ✅ Search banks by name, code, abbreviation, or USSD
- ✅ Get all branches in a specific state
- ✅ Get branches for a specific bank in a specific state
- ✅ NEW: Search branches by Local Government Area (LGA)
- ✅ NEW: Get all banks available in a specific state
- ✅ NEW: Enhanced search functionality with better error handling
Installation
npm install naija-banks-branches-sortcodeUsage
Basic Usage
const Naijabanks = require('naija-banks-branches-sortcode');
// Get all banks
const allBanks = Naijabanks.all();
// Search bank by name
const ubaBank = Naijabanks.banks('UBA');
// Search bank by sort code
const bankByCode = Naijabanks.bankCodes('033');
// Search bank by abbreviation
const bankByAbb = Naijabanks.bankAbb('UBA');
// Search bank by USSD code
const bankByUssd = Naijabanks.bankUssd('*919#');State-based Searches
// Get all banks in a specific state
const osunBanks = Naijabanks.getAllBanksInState('Osun');
// Get all branches in a state
const osunBranches = Naijabanks.getBranchesByState('Osun');
// Get branches for a specific bank in a state
const ubaOsunBranches = Naijabanks.getBranchesByBankAndState('UBA', 'Osun');Local Government Area (LGA) Search
This is the main feature you requested - searching for branches by Local Government Area:
// Search for UBA branches in Ilesha East LGA, Osun State
const ubaIleshaBranches = Naijabanks.searchBranchesByLGA('UBA', 'Osun', 'Ilesha');
// Example: Find UBA branches in Ilesha East LGA
if (ubaIleshaBranches.length > 0) {
ubaIleshaBranches.forEach(branch => {
console.log(`Branch: ${branch.branch}`);
console.log(`Code: ${branch.branchcode}`);
console.log(`Address: ${branch.branchaddress}`);
});
} else {
console.log('No UBA branches found in Ilesha East LGA');
}API Reference
Core Functions
all()- Get all banks in the databasebanks(bankName)- Search bank by namebankCodes(code)- Search bank by sort codebankAbb(abbreviation)- Search bank by abbreviationbankUssd(ussdCode)- Search bank by USSD code
State-based Functions
getAllBanksInState(state)- Get all banks available in a specific stategetBranchesByState(state)- Get all branches in a specific stategetBranchesByBankAndState(bank, state)- Get branches for a specific bank in a state
LGA Search Function
searchBranchesByLGA(bank, state, lga)- Search for branches by Local Government Area
Examples
Example 1: Find UBA branches in Ilesha East LGA
const Naijabanks = require('naija-banks-branches-sortcode');
// You're in Osun State, Ilesha East LGA and want to find UBA branches
const ubaBranches = Naijabanks.searchBranchesByLGA('UBA', 'Osun', 'Ilesha');
console.log(`Found ${ubaBranches.length} UBA branches in Ilesha East LGA:`);
ubaBranches.forEach(branch => {
console.log(`- ${branch.branch} (${branch.branchcode})`);
console.log(` Address: ${branch.branchaddress}`);
});Example 2: Get all banks in Osun State
const osunBanks = Naijabanks.getAllBanksInState('Osun');
console.log('Banks available in Osun State:');
osunBanks.forEach(bank => {
console.log(`- ${bank.bank} (${bank.code}): ${bank.branchCount} branches`);
});Example 3: Search for branches in different LGAs
const searchExamples = [
{ bank: 'UBA', state: 'Osun', lga: 'Ilesha' },
{ bank: 'First Bank', state: 'Osun', lga: 'Oshogbo' },
{ bank: 'Zenith', state: 'Osun', lga: 'Ile Ife' }
];
searchExamples.forEach(example => {
const results = Naijabanks.searchBranchesByLGA(
example.bank,
example.state,
example.lga
);
console.log(`${example.bank} branches in ${example.lga}: ${results.length} found`);
});Data Structure
Each bank object contains:
{
"bank": "UNITED BANK FOR AFRICA PLC",
"code": "033",
"abb": "UBA",
"ussd": "*919#",
"state": {
"Osun": [
{
"branch": "ILESHA BRANCH",
"branchcode": "164",
"branchaddress": "107A, ORINKIRAN STREET, OSHOGBO ROAD, ILESHA,OSUN STATE."
}
]
}
}Supported Banks
- Access Bank (Diamond Bank)
- Citibank Nigeria PLC
- Ecobank Nigeria PLC
- Fidelity Bank PLC
- First Bank Nigeria Limited
- First City Monument Bank PLC
- Guaranty Trust Bank PLC
- Heritage Bank PLC
- Polaris Bank Limited
- Providus Bank Limited
- Stanbic IBTC Bank Ltd
- Standard Chartered Bank Nigeria Ltd
- Sterling Bank PLC
- Union Bank of Nigeria PLC
- United Bank for Africa PLC
- Wema Bank PLC
- Zenith Bank PLC
Running Examples
# Run the main example
npm run example
# Or run specific examples
node examples/index.js
node examples/search-by-lga.js
node examples/bank-info.jsPrerequisites
- npm 6.0.0+
- node 14.0.0+
Install
npm installRun tests
npm run testNode.js Version Compatibility
This package now supports Node.js versions 14.0.0 and above, and npm versions 6.0.0 and above.
Author
👤 Oludare Dominic
- Website: https://dominicoludare.netlify.app/
- Twitter: @pato7dominic
- Github: @OluDominic
- LinkedIn: @dominicoludare
🤝 Contributing
Contributions, issues and feature requests are welcome!Feel free to check issues page. You can also take a look at the contributing guide.
Show your support
Give a ⭐️ if this project helped you!
📝 License
Copyright © 2021 Oludare Dominic. This project is ISC licensed.
Issues
If you encounter any issues, please report them on the GitHub issues page.
This README was generated with ❤️ by readme-md-generator
