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-nric

v0.5.0

Published

Myanmar nric list and validation methods for myanmar nationality identification. !!BETA!!

Downloads

21

Readme

Myanmar NRC

This package is to streamline development for myanmar nric input and verification.

Installation

Using npm:

npm install mm-nric


Using yarn:

yarn add mm-nric


Using pnpm:

pnpm add mm-nric


After installation you can use the package with either import or requrie approach.
Example

import { getStates } from 'mm-nric'

console.log(getStates())

// OR

const mmNric = require('mm-nric')

console.log(mmNric.getStates()

Functions

Generators

Get States

Returns an array of all states.

const states = getStates()

Get District

Returns an array of all districts.

const districts = getDistricts()

Get District by state

Returns an array of districts included in the specified state. Useful for controlling the dropdown values based on the state that the user chose.
NOTE: This function will return an empty array for invalid state code.

const districts = getDistrictsByState(1)

Validators

Validate State

Returns a boolean to check if the specified state code is valid.
NOTE: valid state codes are numbers ranging from 1 to 14

console.log(validateState(1)) // true
console.log(validateState(0)) // false
console.log(validateState(15)) // false

Validate Nric Type

Returns a boolean to check if the specified nric type is valid. Useful to validate raw user inputs

console.log(validateNricType('N')) // true
console.log(validateNricType('A')) // false

Validate Nric Format

Returns a boolean to check if the specified nric string is in valid format. Supports for both myanmar and english language.

console.log(validateNricFormat('12/PABADA(N)0XXXXX')) // en
console.log(validateNricFormat('၁၂/ပဘတ(နိုင်)၀xxxxx')) // mm

Validate Nric (WIP)

Returns a boolean to check if the specified nric string is valid. Supports for both myanmar and english language.

Currently only supports english NRIC

console.log(validateNric('12/PABADA(N)0XXXXX')) // true

Conversions

Convert To English

Convert the provided NRIC string from myanmar to english.

console.log(convertToEnglish('၁၂/ပဇတ(နိုင်)၀၀၀၀၀၀')) // 12/PAZATA(N)000000

Convert To Myanmar

Convert the provided NRIC string from english to myanmar.

console.log(convertToEnglish('12/PAZATA(N)000000')) // ၁၂/ပဇတ(နိုင်)၀၀၀၀၀၀

Data Types

State

interface State {
  en: string;           /* English State Name */
  mm: string;           /* Burmese State Suffix */
  code: number;         /* The State code */
}

District

interface District {
  en: string;           /* English District Suffix */
  mm: string;           /* Burmese District Suffix */
  code: number;         /* The State code */
  fullEn: string;       /* Full English District Name */
  fullMm: string;       /* Full Burmese District Name */
}

Nric Types

enum NricTypesEn {
  N = 'N',
  E = 'E',
  P = 'P',
}

enum NricTypesMm {
  N = 'နိုင်',
  E = 'ဧည့်',
  P = 'ပြု',
}