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

serbia-zip-codes

v1.0.0

Published

Easy access to Serbia zip codes. You can search zip code by city, or city by zip code.

Downloads

4

Readme

Serbia zip codes

Easy access to Serbia zip codes. You can search zip code by city, or city by zip code.

Build Status

Installation

npm install serbia-zip-codes

Usage

const SerbiaZipCodes = require('serbia-zip-codes');

Search city by city:

Synchronous:

const result = SerbiaZipCodes.findByCitySync('loznica');
console.log(result);
// [ { city: 'Loznica', zip_code: '15300' } ]

console.log(result[0].zip_code);
// 15300

With promises

SerbiaZipCodes.findByCity('Novi Sad')
  .then((result) => {
    console.log(result);
    console.log(result[0].zip_code);
  })
  .catch((error) => {
    console.log(error.message);
  });

// [ { city: 'Novi Sad', zip_code: '21000' } ]
// 21000

Search city by zip code:

Synchronous:

const result = SerbiaZipCodes.findByZipSync('15300');
console.log(result);
// [ { city: 'Loznica', zip_code: '15300' } ]

console.log(result[0].city);
// Loznica

With promises

SerbiaZipCodes.findByZip('21000')
  .then((result) => {
    console.log(result);
    console.log(result[0].city);
  })
  .catch((error) => {
    console.error(error.message);
  });
// [ { city: 'Novi Sad', zip_code: '21000' } ]
// Novi Sad

Multiple results example:

Synchronous:

const result = SerbiaZipCodes.findByCitySync('beograd');
console.log(result);

//[ { city: 'Beograd', zip_code: '11000' },
//  { city: 'Beograd Vozdovac', zip_code: '11010' },
//  { city: 'Beograd Čukarica', zip_code: '11030' },
//  { city: 'Beograd Zvezdara', zip_code: '11050' },
//  { city: 'Beograd Palilula', zip_code: '11060' },
//  { city: 'Novi Beograd', zip_code: '11070' },
//  { city: 'Beograd Zemun', zip_code: '11080' },
//  { city: 'Beograd Rakovica', zip_code: '11090' },
//  { city: 'Mali Beograd', zip_code: '24309' } ]

With promises

SerbiaZipCodes.findByZip('214')
  .then((result) => {
    console.table(result);
  })
  .catch((error) => {
    console.error(error.message);
  });

┌─────────┬─────────────────────┬──────────┐
│ (index) │        city         │ zip_code │
├─────────┼─────────────────────┼──────────┤
│    0    │      'Banjani'      │ '14214'  │
│    1    │     'Debeljača'     │ '15214'  │
│    2    │      'Kulina'       │ '18214'  │
│    3    │      'Rgotina'      │ '19214'  │
│    4    │       'Sirig'       │ '21214'  │
│    5    │   'Bačka Palanka'   │ '21400'  │
│    6    │       'Futog'       │ '21410'  │
│    7    │       'Begeč'       │ '21411'  │
│    8    │      'Gložan'       │ '21412'  │
│    9    │     'Čelarevo'      │ '21413'  │
│   10    │        'Bač'        │ '21420'  │
│   11    │    'Karađorđevo'    │ '21421'  │
│   12    │     'Mladenovo'     │ '21422'  │
│   13    │      'Obrovac'      │ '21423'  │
│   14    │    'Tovariševo'     │ '21424'  │
│   15    │      'Selenča'      │ '21425'  │
│   16    │      'Vajska'       │ '21426'  │
│   17    │      'Bodjani'      │ '21427'  │
│   18    │      'Plavna'       │ '21428'  │
│   19    │  'Bačko Novo Selo'  │ '21429'  │
│   20    │   'Nova Gajdobra'   │ '21431'  │
│   21    │     'Gajdobra'      │ '21432'  │
│   22    │      'Silbaš'       │ '21433'  │
│   23    │      'Parage'       │ '21434'  │
│   24    │       'Vrbas'       │ '21460'  │
│   25    │ 'Bačko Dobro Polje' │ '21465'  │
│   26    │      'Kucura'       │ '21466'  │
│   27    │    'Savino Selo'    │ '21467'  │
│   28    │     'Despotovo'     │ '21468'  │
│   29    │      'Pivnice'      │ '21469'  │
│   30    │  'Bački Petrovac'   │ '21470'  │
│   31    │    'Ravno Selo'     │ '21471'  │
│   32    │      'Kulpin'       │ '21472'  │
│   33    │      'Maglić'       │ '21473'  │
│   34    │     'Srbobran'      │ '21480'  │
│   35    │       'Torda'       │ '23214'  │
│   36    │     'Tavankut'      │ '24214'  │
│   37    │  'Gornja Dobrinja'  │ '31214'  │
│   38    │  'Veliko Krčmare'   │ '34214'  │
│   39    │       'Vrba'        │ '36214'  │
│   40    │      'Pojate'       │ '37214'  │
└─────────┴─────────────────────┴──────────┘

Versions

1.0.0 - Sync and Promises

  • sync functions findByCitySync, findByZipSync, getAll
  • promise functions findByCity and findByZip

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request