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

ngx-mitaa

v1.2.0

Published

[![Made in Tanzania](https://img.shields.io/badge/made%20in-tanzania-008751.svg?style=flat-square)](https://github.com/Tanzania-Developers-Community/made-in-tanzania)

Downloads

183

Readme

NgxMitaa

Made in Tanzania

This library provides an Angular service to get all locations

Installation

npm install ngx-mitaa

Or if you use yarn

yarn add ngx-mitaa

Usage

Import the service in your component where you want to use it

import { NgxMitaaService } from 'ngx-mitaa';

Inject the service in your component's constructor or using inject function

constructor(private ngxMitaaService: NgxMitaaService) {}

// or

const ngxMitaaService = inject(NgxMitaaService);
// Get all locations
const locations = this.ngxMitaaService.getLocations();

This will return an array of objects with the following structure;

[
  {
    continent: 'Africa',
    countries: [
      {
        country: 'Tanzania',
        regions: [
          {
            region: 'Dar es Salaam',
            districts: [
              {
                district: 'Ilala Cbd',
                wards: [
                  {
                    ward: 'Kivukoni',
                    streets: ['Kivukoni', 'Sea View'],
                  },
                  {
                    ward: 'Upanga Mashariki',
                    streets: ['Kitonga', 'Kibasila'],
                  },
                ],
              },
            ],
          },
        ],
      },
    ],
  },
];
// Get all continents
const continents = this.ngxMitaaService.getContinents();

This will return an array of strings with the following structure;

[
  'Africa',
  'Antarctica',
  'Asia',
  'Australia',
  'Europe',
  'North America',
  'South America',
];
// Get all countries by continent(defaults to Africa)
const countries = this.ngxMitaaService.getCountries('Africa');

This will return an array of strings with the following structure;

["Tanzania", "Burundi", "Kenya", , "Rwanda", "South Sudan", "Uganda" ...];
// Get all regions by country(default to Tanzania) and continent(defaults to Africa)
const regions = this.ngxMitaaService.getRegions('Tanzania', 'Africa');

This will return an array of strings with the following structure;

[
  "Dar es Salaam",
  "Dodoma",
  "Iringa",
  "Kagera",
  "Kigoma",
  "Kilimanjaro",
  "Lindi",
  "Manyara",
  "Mara",
  "Mbeya",
  ...
];
// Get all districts by region(defaults to Dar es Salaam), country(defaults to Tanzania) and continent(defaults to Africa)
const districts = this.ngxMitaaService.getDistricts(
  'Dar es Salaam',
  'Tanzania',
  'Africa'
);

This will return an array of strings with the following structure;

[
  "Ilala Cbd",
  "Kinondoni",
  "Kigamboni",
  "Temeke",
  "Ubungo",
  "Kurasini",
  "Kigamboni",
  "Kigamboni",
  "Kigamboni",
  "Kigamboni",
  ...
];
// Get all wards by district(defaults to Kinondoni), region(defaults to Dar es Salaam), country(defaults to Tanzania) and continent(defaults to Africa)
const wards = this.ngxMitaaService.getWards(
  'Kinondoni',
  'Dar es Salaam',
  'Tanzania',
  'Africa'
);

This will return an array of strings with the following structure;

[
  "Bunju",
  "Hananasif",
  "Kawe",
  "Kigogo",
  "Kijitonyama",
  "Kinondoni",
  "Kunduchi",
  "Mabwepande",
  "Magomeni",
  ...
];
// Get all streets by ward(defaults to Magomeni), district(defaults to Kinondoni), region(defaults to Dar es Salaam), country(defaults to Tanzania) and continent(defaults to Africa)
const streets = this.ngxMitaaService.getStreets(
  'Magomeni',
  'Kinondoni',
  'Dar es Salaam',
  'Tanzania',
  'Africa'
);
``;

This will return an array of strings with the following structure;

["Dossi", "Idrisa", "Makuti A", "Makuti B", "Suna" ...];

Interface

interface Continent {
  continent: string;
  countries: Country[];
}

interface Country {
  country: string;
  regions: Region[];
}

interface Region {
  region: string;
  districts: District[];
}

interface District {
  district: string;
  wards: Ward[];
}

interface Ward {
  ward: string;
  streets: string[];
}

All interfaces can be imported from the library

import { Continent, Country, Region, District, Ward } from 'ngx-mitaa';

License

MIT

Author

Munir Issa

Give a Star! :star:

If you find this library useful, give it a star so that other deveopers can get to know about it.

Disclaimer

All the location I used to build this repository, I got from an public repository titled tanzania-locations-db, I'm not responsible for any kind of misinformation in it, I tried to locate my home with it found its pretty accurate, so use it to your own risk

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Acknowledgements