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

jp-prefectures

v2.0.1

Published

You can easily handle the prefectures of Japan.

Downloads

3,656

Readme

jp-prefectures

example workflow License: MIT npm version

English | 日本語

This is a package that allows you to easily handle information about prefectures in Japan.

Install

The library is available as an npm package.

npm install jp-prefectures

or

yarn add jp-prefectures

Usage

import {
  findByName,
  findByCode,
  filterByArea,
  prefectures,
  prefectureCodes,
  prefectureNames,
  prefectureEnNames,
  prefectureAreas,
  prefectureCapitals,
} from "jp-prefectures";

// search prefecture by kanji
findByName("北海道");
//=> {code: 1, name: "北海道", enName: "hokkaido", area: "北海道", capital: "札幌市"}

// search prefecture by prefecture code
findByCode(13);
//=> {code: 13, name: "東京都", enName: "tokyo", area: "関東", capital: "新宿区"}

// search prefectures by area kanji
filterByArea("関東")
/*
=> [
  {code: 8, name: "茨城県", enName: "ibaraki", area: "関東", capital: "水戸市"},
  {code: 9, name: "栃木県", enName: "tochigi", area: "関東", capital: "宇都宮市"},
  ...,
  {code: 14, name: "神奈川県", enName: "kanagawa", area: "関東", capital: "横浜市"}
]
*/

// All prefectues
prefectures()
/*
=>
[
  {code: 1, name: "北海道", enName: "hokkaido", area: "北海道", capital: "札幌市"},
  {code: 2, name: "青森県", enName: "aomori", area: "東北", capital: "青森市"},
  ...,
  {code: 47, name: "沖縄県", enName: "okinawa", area: "九州", capital: "那覇市"}
]
*/

// All prefectues code
prefectureCodes()
//=> [1, 2, ..., 47]

// All prefectues name
prefectureNames()
//=> ["北海道", "青森県", ..., "沖縄県"]

// All prefectues english name
prefectureEnNames()
//=> ["hokkaido", "aomori", ..., "okinawa"]

// All prefectues area name
prefectureAreas()
//=> ["北海道", "東北", ..., "九州"]

// All prefectues capital name
prefectureCapitals()
//=> ["札幌市", "青森市", ..., "那覇市"]

Contributing

I'm looking forward to your bug reports and requests for new features!

You can also open an issue or comment on an issue on github and a maintainer(@hatsu38) will reply to you.

It would be my pleasure to star this repository!

If you have any concerns, please contact us at ↓.

https://twitter.com/hatsu_38

Deploy

$ npm version (patch | mainer | major)
$ git tag
$ git push origin $TAG_VERSION
$ gh release create $TAG_VERSION
? Title (optional) $TAG_VERSION
? Release notes Write my own
? Is this a prerelease? No
? Submit? Publish release

License

This code is free to use under the terms of the MIT license.