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 🙏

© 2025 – Pkg Stats / Ryan Hefner

insee-municipality-code

v1.2.1

Published

🇫🇷 Get the INSEE municipality code from postal code and name of French municipality

Readme

🇫🇷 Get INSEE municipality code

tested with jest npm version CircleCI Build Status codecov

Simply provide the postal code and / or name of a French municipality and get the most likely INSEE municipality code

Installation

yarn add insee-municipality-code

or

npm i --save insee-municipality-code

Usage

import InseeCode from "insee-municipality-code"

InseeCode.getCode({ postalCode: "14710", name: "Colombières" }) // "14168"
InseeCode.getCode({ name: "Collonbier", postalCode: "15710" }) // "14168"
InseeCode.getCode({ name: "Lyon" }) // "69381"
InseeCode.getMunicipality("14168") // { postalCode: "14710", name: "COLOMBIERES" }
InseeCode.getMunicipality("96501") // null

Api

| Method | arguments | returned value | throws | | ------ | --------- | -------------- | ------ | | getCode | params: { postalCode: string? \| number?, name: string? } | string: the most likely Insee code regarding your input | will throw if both params are empty | | getMunicipality | string, params: { postalCode: string? \| number? }? | { postalCode: string, name: string }?: the corresponding city (if it exists).1 | will throw if insee code is not well formated (/(\d{2}|2[AB])\d{3}/i) |

1The second argument is optional and used to help decide which postalCode to return when the city corresponding to the Insee code has many options. e.g. : Saint-Maur-des-Fossés has Insee code 94068 and postal codes 94100 and 94210.

Dependencies

Limitations

This package loads in memory the name and postal code of 39k+ French towns. You should probably not try to send this package client side.

Contributing

Please fork this package, and run

yarn install
yarn test

Issues

Something is not working as expected? Some result is wrong? Documentation is missing? You need a different feature / API? Please file an issue, we'll be in touch.

References

(in French)

Financial Support

Gofer 🤝 (the human-centric work-on-demand solution) is the main support of this package.