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

cloud-region-shortener

v1.2.0

Published

Shorten region names of cloud providers for use in resource names

Downloads

25

Readme

Cloud Region Shortener

Abbreviate region names of cloud providers in a standardized way.

Features

  • Convert (long) region names to abbreviated form
  • Specify a maximum length for abbreviations
  • Select from different abbreviation styles (set default style)

Usage

Basic

import { getShortRegion } from 'cloud-region-shortener'

console.log(getShortRegion('westeurope'));
// weu

More Options

import { getShortRegion, Styles } from 'cloud-region-shortener'

// --- MaxLength ---
console.log(getShortRegion('northcentralusstage')); 
// ncuss

console.log(getShortRegion('northcentralusstage', Styles.standard, 4));
// ncus 

setMaxLength(4);
console.log(getShortRegion('northcentralusstage')); 
// ncus

// --- Style ---
console.log(getShortRegion('westeurope', Styles.iso3166)); // style not supported yet
// nl

setDefaultStyle(Styles.iso3166); // style not supported yet
console.log(getShortRegion('westeurope')); // style not supported yet
// nl

Styles

The following will demonstrate different style types and rules using regions germanywestcentral and eastus2stage as an example.

| Example Region | Standard | ISO 3166 | | -------------------- | -------- | -------- | | germanywestcentral | gewc | `` | | eastus2stage | eus2s | |

"Standard"

Abbreviates the long region name 'as is', while following these rules:

  1. A (long) region name is first split into sections.
  2. Each section is then abbreviated according to different rules.
  3. Afterwards abbreviated section are concatenated in the same order

Sections:

  • country / continent
    • always two first characters of section
      germanywestcentral, ==> germany = ge
      eastus2stage, ==> us = us
  • cardinal directions / secondard geographic specifier
    • one character per section
      germanywest central: westcentral ==> wc
      eastus2stage: east ==> e
  • enumerator
    • enumerator is always kept as is (if present)
      germanywestcentral: -
      eastus2stage: 2 ==> 2
  • special characteristic
    • one character per section
      germanywestcentral: -
      eastus2stage: stage ==> s

ISO3166

⚠️ Warning

Not implemented yet

Supported Regions

| Azure Region Name | Standard | | ------------------- | -------- | | eastus | eus | | eastus2 | eus2 | | southcentralus | scus | | westus2 | wus2 | | westus3 | wus3 | | australiaeast | aue | | southeastasia | seas | | northeurope | neu | | swedencentral | swc | | uksouth | uks | | westeurope | weu | | centralus | cus | | northcentralus | ncus | | westus | wus | | southafricanorth | san | | centralindia | cin | | eastasia | eas | | japaneast | jae | | jioindiawest | jinw | | koreacentral | koc | | canadacentral | cac | | francecentral | frc | | germanywestcentral | gewc | | norwayeast | noe | | switzerlandnorth | swn | | uaenorth | uan | | brazilsouth | brs | | centralusstage | cuss | | eastusstage | euss | | eastus2stage | eus2s | | northcentralusstage | ncuss | | southcentralusstage | scuss | | westusstage | wuss | | westus2stage | wus2s | | asia | as | | asiapacific | asp | | australia | au | | brazil | br | | canada | ca | | europe | eu | | france | fr | | germany | ge | | global | gl | | india | in | | japan | ja | | korea | ko | | norway | no | | southafrica | saf | | switzerland | sw | | uae | ua | | uk | uk | | unitedstates | us | | eastasiastage | eass | | southeastasiastage | seass | | centraluseuap | cuse | | eastus2euap | eus2e | | westcentralus | wcus | | southafricawest | safw | | australiacentral | auc | | australiacentral2 | auc2 | | australiasoutheast | ause | | japanwest | jaw | | jioindiacentral | jinc | | koreasouth | kos | | southindia | sin | | westindia | win | | canadaeast | cae | | francesouth | frs | | germanynorth | gen | | norwaywest | now | | switzerlandwest | swe | | ukwest | ukw | | uaecentral | uac | | brazilsoutheast | brse |