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

danh-ngon

v1.0.0

Published

Kho danh ngôn song ngữ Việt–Anh (9.000+ câu) đóng gói sẵn, không cần mạng. Tìm theo chủ đề, tác giả, từ khoá.

Readme

danh-ngon

Kho danh ngôn song ngữ Việt–Anh với hơn 9.000 câu, đóng gói sẵn trong thư viện — không cần kết nối mạng, không cần API key.

npm

Phù hợp cho: ứng dụng "danh ngôn mỗi ngày", widget, bot Telegram/Discord, màn hình chờ, app học tiếng Anh, nội dung mạng xã hội, v.v.

Tính năng

  • 📚 9.000+ danh ngôn kèm bản dịch tiếng Anh và tên tác giả.
  • 🏷️ 18 chủ đề: cuộc sống, tình yêu, thành công, giáo dục, thời gian, sự nghiệp, gia đình, tình bạn, trí tuệ…
  • 🔍 Tìm kiếm không dấu (gõ hanh phuc vẫn ra hạnh phúc).
  • 🎲 Lấy câu ngẫu nhiên, có thể lọc theo chủ đề/tác giả.
  • Zero dependency, dữ liệu nhúng sẵn, hỗ trợ cả ESM và CommonJS, có sẵn type cho TypeScript.

Cài đặt

npm install danh-ngon
# hoặc: yarn add danh-ngon / pnpm add danh-ngon

Bắt đầu nhanh

import { randomQuote, quotesByTopic, search } from "danh-ngon";

// Một câu ngẫu nhiên
const q = randomQuote();
console.log(`"${q.vi}" — ${q.author}`);

// Câu ngẫu nhiên thuộc chủ đề Tình yêu
console.log(randomQuote({ topic: "tinh-yeu" })?.vi);

// Tìm theo từ khoá (không phân biệt dấu)
const ket_qua = search("thanh cong", { limit: 5 });
console.log(`Tìm thấy ${ket_qua.length} câu.`);

CommonJS cũng dùng được:

const { randomQuote } = require("danh-ngon");
console.log(randomQuote().vi);

Kiểu dữ liệu

interface Quote {
  id: number;        // mã định danh ổn định
  vi: string;        // nội dung tiếng Việt
  en: string;        // bản tiếng Anh ("" nếu không có)
  author: string;    // tác giả ("Khuyết danh" nếu không rõ)
  topics: string[];  // các slug chủ đề
}

API

| Hàm | Mô tả | |-----|-------| | getAllQuotes(): Quote[] | Toàn bộ danh ngôn. | | count(): number | Tổng số câu. | | getMeta(): Meta | Thống kê tổng quan. | | getQuoteById(id): Quote \| undefined | Lấy câu theo id. | | randomQuote(opts?): Quote \| undefined | Một câu ngẫu nhiên (lọc {topic, author}). | | randomQuotes(n, opts?): Quote[] | n câu ngẫu nhiên, không trùng. | | quotesByAuthor(name): Quote[] | Lọc theo tác giả (không phân biệt dấu/hoa thường). | | quotesByTopic(slug): Quote[] | Lọc theo slug chủ đề. | | search(keyword, opts?): Quote[] | Tìm trên VI/EN/tác giả ({limit, includeEnglish}). | | listTopics(): Topic[] | Danh sách chủ đề kèm số lượng. | | listAuthors(limit?): {author, count}[] | Tác giả kèm số lượng, giảm dần. |

Danh sách chủ đề (slug)

cuoc-song, tinh-yeu, nhung-manh-ngon-tinh, su-nghiep, tieng-anh, tinh-ban, song-chet, thoi-gian, trai-tim, giao-duc, yeu-nuoc, tri-tue, tam-hon, van-minh-khoa-hoc, gia-dinh, thanh-cong, trich-dan-hay, thay-doi.

Gọi listTopics() để lấy nhãn tiếng Việt và số lượng chính xác.

Ví dụ: "Danh ngôn mỗi ngày"

import { randomQuote } from "danh-ngon";

function danhNgonHomNay() {
  const q = randomQuote({ topic: "cuoc-song" })!;
  return `🌅 ${q.vi}\n   — ${q.author}\n   (${q.en})`;
}

console.log(danhNgonHomNay());

Nguồn dữ liệu & giấy phép

Dữ liệu được tổng hợp và chuẩn hoá từ kho danh ngôn cộng đồng. Mã nguồn thư viện phát hành theo giấy phép MIT.

Đóng góp, báo lỗi dữ liệu: xem repository trên GitHub.