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

mm-nrc

v0.2.5

Published

### Installation

Downloads

17

Readme

Myanmar National Registration Card JSON Data and Utils Helpers

Installation

npm install mm-nrc
# OR
yarn add mm-nrc

Documentation

! Important

States has NAY PYI TAW as 9* which is not needed in NRC. You may use it as you needed.

{
  "id": "sH0ybsmxNuxmeOT_",
  "code": "NAYPYITAW",
  "number": { "en": "9*", "mm": "၉*" },
  "name": { "en": "NAYPYITAW", "mm": "နေပြည်တော်" }
}

When using the library as NRC input, you also need to include NayPyiTaw townships as Mandalay townships.

There are two OUKAMA data in this json data. You can filter out the one you need when getting the township values. Otherwise there will be two OUKAMA in your application.

{
  "id": "KZFQuHHRo7fanPlq",
  "code": "SHWEPAUKKAN",
  "short": {
    "en": "OUKAMA",
    "mm": "ဥကမ"
  },
  "name": {
    "en": "SHWE PAUK KAN",
    "mm": "ရွှေပေါက်ကံ"
  },
  "stateId": "Zvxm3m8cAwCeDgz1",
  "stateCode": "12"
}

{
  "id": "oAIpEryyl6pOobUS",
  "code": "NORTHOKKALAPA",
  "short": {
    "en": "OUKAMA",
    "mm": "ဥကမ"
  },
  "name": {
    "en": "NORTH OKKALAPA",
    "mm": "မြောက်ဥက္ကလာ"
  },
  "stateId": "Zvxm3m8cAwCeDgz1",
  "stateCode": "12"
}
Functions
/** get all nrc raw data */
function getNrcData(): {
  nrcStates: NrcState[];
  nrcTownships: NrcTownship[];
  nrcTypes: NrcType[];
};

/** get all nrc raw states */
function getNrcStates(): NrcState[];

/** get all nrc raw townships */
function getNrcTownships(): NrcTownship[];

/** get all nrc raw types */
function getNrcTypes(): NrcType[];

/** find single nrc state by it's id */
function getNrcStateById(id: string): NrcState;

/** find single nrc township by it's id */
function getNrcTownshipById(id: string): NrcTownship;

/** find single nrc type by it's id */
function getNrcTypeById(id: string): NrcType;

/** find all nrc townships with state id */
function getNrcTownshipsByStateId(stateId: string): NrcTownship[];
Types
type NrcState = {
  id: string;
  code: string;
  number: {
    en: string;
    mm: string;
  };
  name: {
    en: string;
    mm: string;
  };
};

type NrcTownship = {
  id: string;
  code: string;
  short: {
    en: string;
    mm: string;
  };
  name: {
    en: string;
    mm: string;
  };
  stateId: string;
  stateCode: string;
};

type NrcType = {
  id: string;
  name: {
    en: string;
    mm: string;
  };
};

Helpers

/**
 * convert english nrc to myanmar nrc
 *
 * ```js
 * const mmNrc = convertToMmNrc('12/TAMANA(N)112233')
 * console.log(mmNrc) // ၁၂/တမန(နိုင်)112233
 * ```
 */
function convertToMmNrc(engNrc: string): string;

/**
 * convert myanmar nrc to english nrc
 *
 * ```js
 * const mmNrc = convertToEnNrc('၁၂/တမန(နိုင်)112233')
 * console.log(mmNrc) // 12/TAMANA(N)112233
 * ```
 */
function convertToEnNrc(mmNrc: string): string;

/** regex to check if the Nrc is correct pattern */
const pattern = {
  en: /\d{1,2}\/[A-Z]{6,6}\((N|E|P|T|R|S)\)\d{5,6}/,
  mm: /[၀-၉]{1,2}\/[က-အ]{3,3}\((နိုင်|ဧည့်|ပြု|သာသနာ|ယာယီ|စ)\)([၀-၉]{5,6}|[0-9]{5,6})/,
};

/**
 * destructure the provided nrc string
 *
 * ```js
 * const { nrcNumber, nrcType, stateNo, townshipCode } = splitNrc('12/TAMANA(N)112233')
 * console.log({
 *  nrcNumber, // 112233
 *  nrcType, // N
 *  stateNo, // 12
 *  townshipCode, // TAMANA
 * })
 * ```
 */
function splitNrc(nrc: string): {
  stateNo: string;
  townshipCode: string;
  nrcType: string;
  nrcNumber: string;
};