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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pka_opendynamics_2025/citylens-utils

v1.0.0

Published

CityLens Smart City Platform - Tiện ích xử lý dữ liệu đô thị thông minh

Readme

CityLens Utils

Thư viện tiện ích cho nền tảng CityLens Smart City.

Cài đặt

npm install @pka_opendynamics_2025/citylens-utils

Sử dụng

import {
  calculateDistance,
  createNgsiLdId,
  getAqiInfo,
  formatDateVi,
  ReportStatus,
  getReportStatusInfo,
} from '@pka_opendynamics_2025/citylens-utils';

// Tính khoảng cách giữa 2 điểm
const distance = calculateDistance(21.0285, 105.8542, 21.0378, 105.8342);
console.log(`Khoảng cách: ${distance.toFixed(2)} km`);

// Tạo NGSI-LD Entity ID
const entityId = createNgsiLdId('CivicIssue', '12345');
// => 'urn:ngsi-ld:CivicIssue:12345'

// Lấy thông tin AQI
const aqiInfo = getAqiInfo(75);
console.log(aqiInfo.labelVi); // => 'Trung bình'

// Format ngày tháng tiếng Việt
const dateStr = formatDateVi(new Date());
console.log(dateStr); // => '24/01/2025 21:30'

// Lấy thông tin trạng thái báo cáo
const statusInfo = getReportStatusInfo(ReportStatus.IN_PROGRESS);
console.log(statusInfo.labelVi); // => 'Đang xử lý'

API

Tiện ích tọa độ địa lý

  • calculateDistance(lat1, lon1, lat2, lon2) - Tính khoảng cách (km)
  • toRadians(degrees) - Chuyển độ sang radian
  • toDegrees(radians) - Chuyển radian sang độ
  • isValidCoordinate(lat, lon) - Kiểm tra tọa độ hợp lệ

Tiện ích NGSI-LD

  • createNgsiLdId(entityType, id) - Tạo URN chuẩn NGSI-LD
  • parseNgsiLdId(urn) - Phân tích URN
  • isValidNgsiLdUrn(urn) - Kiểm tra URN hợp lệ

Tiện ích AQI

  • getAqiInfo(aqi) - Lấy thông tin mức độ AQI
  • AqiLevel - Enum các mức độ AQI

Tiện ích format

  • formatNumberVi(num) - Format số theo chuẩn Việt Nam
  • formatDateVi(date) - Format ngày tháng tiếng Việt
  • formatDistance(km) - Format khoảng cách thân thiện

Tiện ích báo cáo

  • getReportStatusInfo(status) - Lấy thông tin trạng thái
  • ReportStatus - Enum trạng thái báo cáo

Giấy phép

GPL-3.0