Socket
Book a DemoInstallSign in
Socket

swiss-zipcodes

Package Overview
Dependencies
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swiss-zipcodes

Swiss zip codes

latest
npmnpm
Version
1.0.9
Version published
Maintainers
3
Created
Source

Build Status GitHub issues npm GitHub stars

swiss-zipcodes

Purpose

Search and validate swiss zip codes

Usage

npm i --save swiss-zipcodes
# or
npm install https://github.com/creadi/swiss-zipcodes

and

import { search, validate, cityFromZip, allZips } from 'swiss-zipcodes'

Search by any combination of:

  • zip (number)
  • canton (string)
  • commune (string)
search({ zip: 4054 })

returns

[
  {
    zip: 4054,
    canton: 'BS',
    commune: 'Basel'
  }
]

validate()

Validate zip code as number or string

validate(4054)

// or

validate('4054')

returns true

cityFromZip()

Get an array of commune names from a zip code ( number or string)

cityFromZip(4052)

// or

cityFromZip('4052')

returns

[
  'Basel',
  'Münchenstein'
]

allZips

is an array of zipcodes (number)

Data

Data from Federal Statistics.

Direct link to excel sheet.

Update 1.0.6

Add data from geonames extraction

Keywords

Swiss

FAQs

Package last updated on 15 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts