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

nigerian-area-postal-data

v1.1.2

Published

A TypeScript utility package for Nigerian area council postal data.

Downloads

22

Readme

Nigeria Area Council Data Package

npm License

A TypeScript utility package designed to provide easy access to data related to area councils, districts, postal codes, and settlements in Nigeria. This package aims to simplify the retrieval of important geographical information for developers and applications.

Table of Contents

Nigeria Area Council Data Package

npm License

A TypeScript utility package designed to provide easy access to data related to area councils, districts, postal codes, and settlements in Nigeria. This package aims to simplify the retrieval of important geographical information for developers and applications.

Table of Contents

Features

  • Retrieve Postal Codes: Quickly fetch postal codes using area council names or town names.
  • Get Town Information: Find towns, districts, and area councils associated with a postal code.
  • Area Council and District Data: Access lists of all area councils and districts within an area council.
  • TypeScript Support: Built with TypeScript for improved type safety and developer experience.
  • Simple API: Easy-to-use functions that integrate seamlessly into your projects.

Supported States and Countries

  • Country: Nigeria
  • States:
    • Federal Capital Territory (Abuja)

Installation

To install the package, use npm:

npm install nigerian-area-postal-data

Usage

Here's a quick example of how to use the package:

import { getPostalCode } from 'nigerian-area-postal-data';

// Get postal codes for an area council
const areaCouncilResult = getPostalCode.byAreaCouncil('Abuja');
console.log(areaCouncilResult);

// Get postal code for a town
const townResult = getPostalCode.byTown('Lugbe');
console.log(townResult);

// Get towns for a postal code
const postalCodeResult = getPostalCode.getTowns('900107');
console.log(postalCodeResult);

// Get all area councils
const allAreaCouncils = getPostalCode.getAllAreaCouncils();
console.log(allAreaCouncils);

// Get districts in an area council
const districts = getPostalCode.getDistricts('Abuja');
console.log(districts);

API Reference

getPostalCode.byAreaCouncil(areaCouncil: string)

Returns postal codes and districts for the given area council.

getPostalCode.byTown(town: string)

Returns postal codes, districts, and area councils for the given town.

getPostalCode.getTowns(postalCode: string)

Returns towns, district, and area council for the given postal code.

getPostalCode.getAllAreaCouncils()

Returns all area councils.

getPostalCode.getDistricts(areaCouncil: string)

Returns all districts for the given area council.

Examples

Validating an Address

import { getPostalCode } from 'nigerian-area-postal-data';

function validateAddress(town: string, postalCode: string): boolean {
  const townResult = getPostalCode.byTown(town);
  const postalCodeResult = getPostalCode.getTowns(postalCode);

  if (typeof townResult === 'string' || typeof postalCodeResult === 'string') {
    return false; // Town or postal code not found
  }

  return townResult.postalCodes.includes(postalCode);
}

console.log(validateAddress('Lugbe', '900107')); // true
console.log(validateAddress('Lugbe', '900101')); // false

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License.

Supported States and Countries

  • Country: Nigeria
  • States:
    • Federal Capital Territory (Abuja)

Installation

To install the package, use npm:

npm install nigerian-postal-data

Usage

Here's a quick example of how to use the package:

import { getPostalCode } from 'nigerian-area-postal-data';

// Get postal codes for an area council
const areaCouncilResult = getPostalCode.byAreaCouncil('Abuja');
console.log(areaCouncilResult);

// Get postal code for a town
const townResult = getPostalCode.byTown('Lugbe');
console.log(townResult);

// Get towns for a postal code
const postalCodeResult = getPostalCode.getTowns('900107');
console.log(postalCodeResult);

// Get all area councils
const allAreaCouncils = getPostalCode.getAllAreaCouncils();
console.log(allAreaCouncils);

// Get districts in an area council
const districts = getPostalCode.getDistricts('Abuja');
console.log(districts);

API Reference

getPostalCode.byAreaCouncil(areaCouncil: string)

Returns postal codes and districts for the given area council.

getPostalCode.byTown(town: string)

Returns postal codes, districts, and area councils for the given town.

getPostalCode.getTowns(postalCode: string)

Returns towns, district, and area council for the given postal code.

getPostalCode.getAllAreaCouncils()

Returns all area councils.

getPostalCode.getDistricts(areaCouncil: string)

Returns all districts for the given area council.

Examples

Validating an Address

import { getPostalCode } from 'nigerian-area-postal-data';

function validateAddress(town: string, postalCode: string): boolean {
  const townResult = getPostalCode.byTown(town);
  const postalCodeResult = getPostalCode.getTowns(postalCode);

  if (typeof townResult === 'string' || typeof postalCodeResult === 'string') {
    return false; // Town or postal code not found
  }

  return townResult.postalCodes.includes(postalCode);
}

console.log(validateAddress('Lugbe', '900107')); // true
console.log(validateAddress('Lugbe', '900101')); // false

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License.