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 🙏

© 2025 – Pkg Stats / Ryan Hefner

cleano

v1.0.3

Published

輕巧好用的工具庫,提供日期格式化與 HTML 字符轉義功能

Downloads

26

Readme

🧼 cleano

A tiny JavaScript utility toolkit for cleaning up your strings and formatting your dates — the cleaner your data, the happier your UI.

📦 Features

🧽 htmlEscape(str) – Escape HTML special characters to prevent XSS attacks.

🧼 htmlUnescape(str) – Unescape HTML special characters back to their original form.

🕒 dateFormat(dateStr) – Format a date string into YYYY-MM-DD HH:MM:SS for clearer display.

🚀 Installation npm install cleano

or

pnpm add cleano

📋 Usage In Node.js const { htmlEscape, htmlUnescape, dateFormat } = require("cleano");

// HTML escaping example const dirtyHTML = 'Hello & welcome!'; const escaped = htmlEscape(dirtyHTML); // → '<div class="box">Hello & welcome!</div>'

// HTML unescaping example const unescaped = htmlUnescape(escaped); // → 'Hello & welcome!'

// Date formatting example const formatted = dateFormat("2025-04-17T09:30:00"); // → '2025-04-17 09:30:00'

In ES modules import { htmlEscape, htmlUnescape, dateFormat } from "cleano";

// Same usage as above

🔍 API Reference htmlEscape(str)

Escapes HTML special characters (<, >, ", ', &) to their corresponding HTML entities.

htmlEscape('alert("XSS")'); // → '<script>alert("XSS")</script>'

htmlUnescape(str)

Converts HTML entities back to their original characters.

htmlUnescape("<div>Hello & world</div>"); // → 'Hello & world'

dateFormat(dateStr)

Takes a date string (or Date object) and returns a formatted string in the pattern YYYY-MM-DD HH:MM:SS.

dateFormat("2025-04-17T09:30:00"); // → '2025-04-17 09:30:00'

dateFormat(new Date(2025, 3, 17, 9, 30, 0)); // → '2025-04-17 09:30:00'

📝 License

MIT

🤝 Contributing

Contributions, issues and feature requests are welcome!

🙏 Support

Give a ⭐️ if this project helped you!

中文 🧼 cleano

一個簡單的 JavaScript 工具包,專門用來清理字串並格式化日期 —— 讓你的資料更乾淨,UI 更順暢。

📦 功能

🧽 htmlEscape(str) – 轉義 HTML 特殊字元,避免 XSS 攻擊。

🧼 htmlUnescape(str) – 還原 HTML 特殊字元,讓 HTML 字串回復原狀。

🕒 dateFormat(dateStr) – 格式化日期字串為 YYYY-MM-DD HH:MM:SS 格式,讓日期顯示更清晰。

🚀 安裝 npm install cleano

或者

yarn add cleano

或者

pnpm add cleano

📋 使用方法 在 Node.js 中使用 const { htmlEscape, htmlUnescape, dateFormat } = require("cleano");

// HTML 轉義範例 const dirtyHTML = 'Hello & welcome!'; const escaped = htmlEscape(dirtyHTML); // → '<div class="box">Hello & welcome!</div>'

// HTML 反轉義範例 const unescaped = htmlUnescape(escaped); // → 'Hello & welcome!'

// 日期格式化範例 const formatted = dateFormat("2025-04-17T09:30:00"); // → '2025-04-17 09:30:00'

在 ES 模組中使用 import { htmlEscape, htmlUnescape, dateFormat } from "cleano";

// 使用方法同上

🔍 API 參考 htmlEscape(str)

將 HTML 特殊字元 (<, >, ", ', &) 轉換為對應的 HTML 實體。

htmlEscape('alert("XSS")'); // → '<script>alert("XSS")</script>'

htmlUnescape(str)

將 HTML 實體轉換回原始字元。

htmlUnescape("<div>Hello & world</div>"); // → 'Hello & world'

dateFormat(dateStr)

接受日期字串(或 Date 物件)並返回格式為 YYYY-MM-DD HH:MM:SS 的格式化字串。

dateFormat("2025-04-17T09:30:00"); // → '2025-04-17 09:30:00'

dateFormat(new Date(2025, 3, 17, 9, 30, 0)); // → '2025-04-17 09:30:00'

📝 授權

MIT

🤝 貢獻

歡迎提供貢獻、問題和功能請求!

🙏 支持

如果這個專案對你有幫助,請給它一個 ⭐️!