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

@kitmodule/kityaml

v1.0.6

Published

Convert JavaScript objects to YAML front matter and Markdown in vanilla JavaScript lightweight, dependency-free, and easy to use.

Readme

📝 KitYAML by Kitmodule

Chuyển đổi JavaScript object thành YAML hoặc Markdown Front Matter — nhẹ, không phụ thuộc thư viện khác, và dễ sử dụng.

English | Tiếng Việt

npm version license

✨ Tính năng

  • 🏷️ Chuyển đổi JavaScript object thành YAML, hỗ trợ nested object và array.
  • 📄 Tạo full Markdown front matter với delimiters ---.
  • 🔀 Chọn kiểu array: inline hoặc block.
  • ⚡ Hoàn toàn vanilla JavaScript, không cần phụ thuộc.
  • 💨 Hỗ trợ helper nhanh để tạo front matter chỉ với một dòng: yamlFrontMatter(obj, body).

🚀 Cài đặt

Sử dụng npm

npm install @kitmodule/kityaml-js

Sử dụng CDN

<script src="https://unpkg.com/@kitmodule/kityaml/dist/kityaml.min.js"></script>

hoặc

<script src="https://cdn.jsdelivr.net/npm/kityaml/dist/kityaml.min.js"></script>

💡 Cách dùng

Trình duyệt (CDN)

<script src="https://unpkg.com/@kitmodule/kityaml-js/dist/kityaml.min.js"></script>
<script>
  const obj = { title: "Bài viết của tôi", tags: ["js", "yaml"] };
  const body = "Xin chào thế giới!";

  const yaml = new KitYAML(obj);
  console.log(yaml.frontMatter(body));
</script>

Node.js / CommonJS

const { KitYAML, yamlFrontMatter } = require('kityaml-js');

// Chuyển object thành YAML
const obj = { title: "Bài viết của tôi", tags: ["js", "yaml"] };
const yaml = new KitYAML(obj).block(); // kiểu array block
console.log(yaml.convert());

// Tạo front matter nhanh
console.log(yamlFrontMatter(obj, "Xin chào thế giới!"));

🧩 Tham chiếu API

new KitYAML(obj)

| Tham số | Kiểu | Mô tả | | ------- | ------ | ------------------------------------- | | obj | object | JavaScript object thuần để chuyển đổi |

Instance Methods

| Method | Mô tả | | ------------------------ | ------------------------------------------------ | | .inline(enable = true) | Sử dụng array kiểu inline (["a", "b"]) | | .block(enable = true) | Sử dụng array kiểu block (- a\n- b) | | .convert() | Chuyển object thành chuỗi YAML | | .frontMatter(body="") | Chuyển object + body thành Markdown front matter |

Helper toàn cục

| Function | Mô tả | | ---------------------------- | ------------------------------- | | yamlFrontMatter(obj, body) | Tạo nhanh Markdown front matter |

🧪 Ví dụ Output

const obj = { title: "Bài viết của tôi", tags: ["js", "yaml"] };
const body = "Đây là nội dung bài viết.";

console.log(yamlFrontMatter(obj, body));

Output:

title: "Bài viết của tôi"
tags:
  - "js"
  - "yaml"
Đây là nội dung bài viết.

☕ Ủng hộ tác giả

Nếu bạn thấy thư viện hữu ích, có thể ủng hộ tôi:

Ko-fi Buy Me a Coffee GitHub Sponsors Patreon PayPal

🧾 License

Phát hành theo MIT License © 2025 Huỳnh Nhân Quốc · Open Source @Kit Module