hk-mtr-util
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

HK MTR Util

A simple TypeScript Library contains information about HK MTR.

Installation

$ npm install hk-mtr-util
or
$ yarn add hk-mtr-util

Usage

Translation

import { MTRUtil } from 'hk-mtr-util';

const stations = MTRUtil.getKowloonLocation();
// [KOWLOON, MONG_KOK, LAI_CHI_KOK, ...]

const translatedStations = stations.map(MTRUtil.translate);
// ["九龍", "旺角", "荔枝角", ...]

By Area

import { MTRUtil } from 'hk-mtr-util';

// Kowloon
const stations = MTRUtil.getKowloonLocation();

// Island
const stations = MTRUtil.getIslandLocation();

// New Territories
const stations = MTRUtil.getNewTerritoriesLocation();

By Line

import { MTRUtil } from 'hk-mtr-util';

// Kwun Tong Line
const stations = MTRUtil.getKwunTongLine();

// Island Line
const stations = MTRUtil.getIslandLine();

// Disneyland Resort Line
const stations = MTRUtil.getDisneylandResortLine();

// etc...

Use Enum

import { IslandLine, SouthIslandLine } from 'hk-mtr-util';

const oceanPark = SouthIslandLine.OCEAN_PARK;

const central = IslandLine.CENTRAL;

Type Definition

import { MTRUtil } from 'hk-mtr-util';
import type { District, AirportExpressLine, IslandLine } from 'hk-mtr-util';

const allStations: District[] = MTRUtil.getAllLocation();

const airportStations: AirportExpressLine[] = MTRUtil.getAirportExpressLine();

const islandStations: IslandLine[] = MTRUtil.getIslandLine();

Package Sidebar

Install

npm i hk-mtr-util

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

104 kB

Total Files

41

Last publish

Collaborators

  • jamyth