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 🙏

© 2026 – Pkg Stats / Ryan Hefner

mock-ch-names

v0.0.3

Published

Create mock Swiss names together with an appropriate location

Downloads

11

Readme

Swiss Mock names

Quickstart: JavaScript/TypeScript API

Install the module as follows:

npm i mock-ch-names
# or
yarn add mock-ch-names

Use as follows to get a mock person from anywhere in Switzerland:

import { mockNameLocation } from "mock-ch-names";

console.log(mockNameLocation());

Possible output:

{
  first: 'Martin',
  last: 'Meier',
  gender: 'm',
  plz: '7208',
  town: 'Malans GR',
  townNoCanton: 'Malans',
  canton: 'GR'
}

(If the town name in the postal database does not end in the canton's abbreviation, town and townNoCanton are identical.)

To only get mock people from a particular canton, pass the canton's two-letter abbreviation (e.g., SH) as an optional parameter to mockNameLocation().

Data sources

This database of mock Swiss names is based on the following data:

Data format

Raw data

For description of the raw/ data, see the Swiss Post descriptions above.

Processed data

The data in src/data/ is JSON matching the following TypeScript types:

type NameMap = Record<
  string,
  {
    f: [Array1Plus<string>, Array1Plus<string>];
    m: [Array1Plus<string>, Array1Plus<string>];
    l: string;
    c: Canton;
  }
>;
type PlzMap = Record<string, [string, string]>;

where Array1Plus<string> is an array of at least one string (maximum five, due to the format of the Swiss Post data). Any PLZ (postal code) area which does not have at least one male/female first/last name each, will be filtered out. (E.g. "8261 Hemishofen" is missing, because the raw data does not contain any female first names. The raw files include name information only, when more than five people have the same name.)