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

@naruebedt/dtd

v0.1.0

Published

Universal data conversion library — parse any input format into a canonical model and serialize it back out to any other format.

Downloads

20

Readme

dtd

ระบบแปลงข้อมูลแบบ any-to-any — ไม่ว่า input จะมาในรูปแบบไหน ก็แปลง/ส่งออกเป็นอีกฟอร์แมตได้ทันที สร้างด้วย Bun + TypeScript

A universal data conversion library. Parse any supported input format into one neutral, canonical model, then serialize it out to any other format.

ติดตั้ง

# ติดตั้ง global (ใช้คำสั่ง dtd ได้ทุกที่)
bun add -g @naruebeth/dtd
# หรือ
npm install -g @naruebeth/dtd

ใช้งานเป็น CLI

dtd login                                    # login ครั้งแรก
dtd whoami                                   # ดูสถานะ
dtd -i config.yaml -o config.json           # แปลงจากไฟล์ (เดา format จากนามสกุล)
dtd -i data.csv -t yaml                     # กำหนด output format
dtd --from csv --to json < data.csv         # ผ่าน stdin
dtd --list-formats                           # ดู format ที่รองรับ
dtd logout                                   # logout

ฟอร์แมตที่รองรับ

| Format | Names / aliases | Extensions | | ------ | --------------- | ---------- | | JSON | json | .json | | CSV | csv | .csv | | TSV | tsv, tab | .tsv, .tab | | YAML | yaml, yml | .yaml, .yml | | XML | xml | .xml |

แนวคิด (Architecture)

หัวใจคือ canonical intermediate representation (IR) ตัวกลางเดียว ทุก adapter จะแปลงเข้า/ออกจาก IR นี้เท่านั้น ไม่ต้องรู้จักฟอร์แมตอื่น

input (any format) ──parse──▶ IR (canonical model) ──serialize──▶ output (any format)
                                      │
                                  transform (optional)

ผลคือ: เพิ่ม adapter ใหม่ 1 ตัว → แปลงไป-กลับกับ ทุก ฟอร์แมตที่มีอยู่ได้ทันที

ใช้งานเป็น Library

import { convert, parse, serialize, detectFormat } from "@naruebeth/dtd";

// แปลงตรงๆ ระบุ from/to
const yaml = convert('{"name":"Aung","tags":["a","b"]}', { from: "json", to: "yaml" });

// ไม่ระบุ from → ตรวจจับฟอร์แมตอัตโนมัติจากเนื้อหา
const xml = convert('{"user":{"id":1}}', { to: "xml" });

// parse เป็น canonical model
const value = parse("name,age\nAung,30\n", "csv");
// → [{ name: "Aung", age: 30 }]

// serialize จาก canonical model
serialize(value, "yaml");

// ตรวจจับฟอร์แมต
detectFormat("---\nname: Aung\n"); // → "yaml"

Transform กลางทาง (pipeline)

const out = convert(csvText, {
  from: "csv",
  to: "json",
  transform: (rows) => (rows as any[]).filter((r) => r.age >= 18),
});

เพิ่มฟอร์แมตใหม่ (Extensibility)

import { registerAdapter, type FormatAdapter } from "@naruebeth/dtd";

const ndjsonAdapter: FormatAdapter = {
  name: "ndjson",
  extensions: [".ndjson", ".jsonl"],
  parse: (input) =>
    input.split("\n").filter(Boolean).map((line) => JSON.parse(line)),
  serialize: (value) =>
    (value as unknown[]).map((v) => JSON.stringify(v)).join("\n") + "\n",
};

registerAdapter(ndjsonAdapter);

เทสต์

bun test

License

MIT