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

nepali

v1.0.2

Published

A comprehensive province for Nepali states, cities, quotes, number conversion, and more.

Downloads

12

Readme

nepali

A Comprehensive NPM Package for Nepali Province and Cities

Table of Contents

Introduction

nepali is an npm package that provides comprehensive functionality for accessing information about Nepali provinces, cities, and related data as well as utilities for working with Nepali dates. This package facilitates easy conversion between English and Nepali names for provinces, cities, and other geographical entities within Nepal. It also includes functions to work with Nepali dates.

Installation

You can install nepali via npm:

npm install nepali

Usage

Importing province functions

import {
    getAllProvinces,
    getProvinceDetails,
    getCapital,
    getDistricts,
    getCities,
    getZipcode,
    getAllMetropolitanCities,
    getAllSubMetropolitanCities
} from 'nepali/povince';

Example usage for provinces and cities

Get all Province, Metropolitan Cities and Sub-Metropolitan Cities names in Nepali

import React from 'react';
import {
  getAllProvinces,
  getProvinceDetails,
  getCapital,
  getDistricts,
  getCities,
  getZipcode,
  getAllMetropolitanCities,
  getAllSubMetropolitanCities
} from 'nepali/province';

const NepalProvince = () => {
  // Scenario 0: Get all province names in Nepali
  const allProvincesNepali = getAllProvinces();

  // Scenario 1: Get province details in Nepali
  const provinceDetailsNepali = getProvinceDetails("Koshi Pradesh");

  // Scenario 2: Get cities in Nepali for Koshi Pradesh
  const citiesProvince1Nepali = getCities("Koshi Pradesh");

  // Scenario 3: Get capital in Nepali for Koshi Pradesh
  const capitalProvince1Nepali = getCapital("Koshi Pradesh");

  // Scenario 4: Get districts in Nepali for Koshi Pradesh
  const districtsProvince1Nepali = getDistricts("Koshi Pradesh");

  // Scenario 5: Get zip codes in Nepali for Biratnagar
  const zipCodeBiratnagarNepali = getZipcode("Biratnagar");

  // Check if zipCodeBiratnagarNepali is an array
  const isArray = Array.isArray(zipCodeBiratnagarNepali);

  // Scenario 7: Get all Metropolitan Cities
  const allMetropolitanCities = getAllMetropolitanCities();

  // Scenario 8: Get all Sub-Metropolitan Cities
  const allSubMetropolitanCities = getAllSubMetropolitanCities();

  return (
    <div>
      <h1>Scenario 0: All Province Names in Nepali</h1>
      <ul>
        {allProvincesNepali.map((province, index) => (
          <li key={index}>{province.name}</li>
        ))}
      </ul>

      <h1>Scenario 1: Province Details in Nepali</h1>
      {provinceDetailsNepali && (
        <div>
          <p>Province Name: {provinceDetailsNepali.name}</p>
          <p>Capital: {provinceDetailsNepali.capital}</p>
          <p>Cities: {provinceDetailsNepali.cities.map((city, index) => (
            <span key={index}>{city.name} ({city.zipCode}), </span>
          ))}</p>
          <p>Districts: {provinceDetailsNepali.districts.join(', ')}</p>
        </div>
      )}

      <h1>Scenario 2: Cities in Nepali for Koshi Pradesh</h1>
      <ul>
        {citiesProvince1Nepali.map((city, index) => (
          <li key={index}>{city.name} - {city.zipCode} ({city.type})</li>
        ))}
      </ul>

      <h1>Scenario 3: Capital in Nepali for Koshi Pradesh</h1>
      <p>{capitalProvince1Nepali}</p>

      <h1>Scenario 4: Districts in Nepali for Koshi Pradesh</h1>
      <ul>
        {districtsProvince1Nepali.map((district, index) => (
          <li key={index}>{district}</li>
        ))}
      </ul>

      <h1>Scenario 5: Zip Codes in Nepali for Biratnagar</h1>
      <ul>
        {isArray ? (
          zipCodeBiratnagarNepali.map((zipcode, index) => (
            <li key={index}>
              {zipcode.name} - {zipcode.zipCode} ({zipcode.type})
            </li>
          ))
        ) : (
          <li>{zipCodeBiratnagarNepali}</li>
        )}
      </ul>

      <h1>Scenario 7: All Metropolitan Cities</h1>
      <ul>
        {allMetropolitanCities.map((city, index) => (
          <li key={index}>{city.name} - {city.zipCode}</li>
        ))}
      </ul>

      <h1>Scenario 8: All Sub-Metropolitan Cities</h1>
      <ul>
        {allSubMetropolitanCities.map((city, index) => (
          <li key={index}>{city.name} - {city.zipCode}</li>
        ))}
      </ul>
    </div>
  );
};

export default NepalProvince;

Importing the date functions

import { 
    getCurrentNepaliDate, 
    getCurrentNepaliDay, 
    getCurrentNepaliMonth, 
    getCurrentNepaliYear, 
    getCurrentNepaliDayOfWeek,
    convertADToNepaliDate,
    formatNepaliDate 
} from 'nepali/dates';

Example Usage for Dates

import { 
    getCurrentNepaliDate, 
    getCurrentNepaliDay, 
    getCurrentNepaliMonth, 
    getCurrentNepaliYear, 
    getCurrentNepaliDayOfWeek,
    convertADToNepaliDate,
    formatNepaliDate 
} from 'nepali/dates';

const NepaliDateComponent = () => {
  return (
    <div>
      <h1>Current Nepali Date</h1>
      <p>{getCurrentNepaliDate()}</p>
      
      <h2>Nepali Date Details</h2>
      <p>Day: {getCurrentNepaliDay()}</p>
      <p>Month: {getCurrentNepaliMonth()}</p>
      <p>Year: {getCurrentNepaliYear()}</p>
      <p>Day of the Week: {getCurrentNepaliDayOfWeek()}</p>
      
      <h2>Formatted Nepali Date</h2>
      <p>{formatNepaliDate(convertADToNepaliDate(1997, 10, 5), 'YYYY-MM-DD')}</p>
    </div>
  );
};

export default NepaliDateComponent;

License

This project is licensed under the MIT License - see the LICENSE file for details.