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

postnumer

v1.2.4

Published

Icelandic post-codes (Póstnúmer) and locality names as a JavaScript object.

Downloads

16

Readme

Icelandic Post-Codes ("Póstnúmer")

Icelandic post-codes (Póstnúmer) and locality names as a JavaScript object. Also includes the dative form ("þágufall") of the locality name.

This module also contains a lookup table for Þjóðskrá's (Iceland's National Registry) "magic codes" for localities, counties, countries and continents.

npm install postnumer
yarn add postnumer
bun add postnumer

Contents:


Postal Codes

The postal code information isf fetched from an official data-source linked to from this page: https://www.byggdastofnun.is/is/postthjonusta/postnumer

See postnumerMeta for information on when your version of the data was last updated.

import { postnumerMeta } from 'postnumer';

console.log(postnumerMeta.lastUpdated);
// "2024-02-18"

postalCodes

Type: Array<{ postcode: number, name: string, name_dative: string }>

An array containing every post-code ("póstnúmer") in Iceland, along with its corresponding place name.

Ideal for generating drop-downs, auto-completes, etc.

import { postalCodes } from 'postnumer';

const lastItem = postalCodes[postalCodesArr.length - 1];
lastItem.postcode; // 902
lastItem.name; // 'Vestmannaeyjar'
lastItem.name_dative; // 'Vestmannaeyjum'

postalCodeMap

Type: Record<number, { name: string, name_dative: string }>

Lookup table for the place names (localities) of every known post-code ("póstnúmer") in Iceland.

import { postalCodeMap } from 'postnumer';

const info = postalCodeMap[200];
info.postcode; // 200
info.name; // 'Kópavogur'
info.name_dative; // 'Kópavogi'

National Registry Place Codes

Iceland's National Registry ("Þjóðskrá") uses a set of "magic codes" to refer to localities, counties, countries and continents.

This information is sourced from Þjóðskrá's homepage: https://www.skra.is/um-okkur/utgafur-og-skjol/taknmal-thjodskrar


thjodskraPlaces

Type: Record<string|number, string>

Lookup table for Þjóðskrá's place and couuntry code values for localities, counties, countries and continents.

It's useful for translating Þjóðskrá's cryptic codes to human-readable names.

import { thjodskraPlaces } from 'postnumer';

const place1 = thjodskraPlaces['3606']; // 'Borgarnes'
const place2 = thjodskraPlaces['XT']; // 'Afríka, ótilgreint land'

NOTE: Þjóðskrá also has similar magic codes for geners, marital status, religious affiliation, etc. This module considers those codes out of scope.


Contributing

Because the (shameful) lack of public APIs, the data exported by this module has to be manually updated. Find detailed step-by-step directions at the top of postnumer.mjs and places.mjs.

Pull requests welcome, and please open an issue if you have ideas for new features or improvements.


Changelog

See CHANGELOG.md


Other Iceland-Themed Libraries

  • is-kennitala - Best-of-breed kennitala (Icelandic national ID) validation and utility library.
  • fridagar - Icelandic public holidays and other commonly observed 'special' days.