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

js-helper-cli

v0.1.2

Published

CLI to explore JavaScript built-in objects, methods, and properties

Readme

JS Helper CLI

🚀 你的命令行 JavaScript 交互式速查手册。

JS Helper CLI 是一个实用的命令行工具,旨在帮助开发者快速查看、探索和理解 JavaScript 内置对象、Web API 及其方法和属性。

无论你是需要快速查找 Array.prototype.reduce 的用法,还是想探索 window.localStorage 的 API 细节,JS Helper CLI 都能在终端中为你提供即时、详细的中文文档和交互式体验。

它内置了 jsdom 环境,因此你可以像在浏览器控制台中一样查看 documentlocationhistory 等 Web API 对象。

✨ 特性

  • 📚 全面的文档库:覆盖 ES6+ 标准内置对象(Array, Object, Promise...)及常用 Web API(DOM, BOM, Fetch...)。
  • 🌏 真实的 Web 环境:基于 jsdom 模拟完整的浏览器环境,支持查看 windowdocument 等对象原型链。
  • 🔍 智能交互体验:提供类似 IDE 的交互式菜单,支持模糊搜索(虽然目前是列表选择,未来可期),逐级深入查看对象成员。
  • 📝 详细的中文说明
    • 功能描述:清晰解释方法或属性的作用。
    • 使用示例:提供典型的代码调用形式。
    • 注意事项:列出常见的坑和使用限制。
  • 零延迟查询:无需打开浏览器搜索 MDN,直接在终端获取最核心的信息。
  • 🛡️ 类型与作用域标识:清晰区分静态方法、实例方法(prototype)、属性和访问器。

📦 安装

你需要安装 Node.js (版本 >= 16)。

全局安装(推荐)

这样你可以在任何目录下使用 js-helper 命令:

npm install -g js-helper-cli

💡 提示:安装后,你也可以使用简写命令 js-hp 来代替 js-helper,输入更快捷!

使用 npx 临时运行

无需安装,直接运行:

npx js-helper-cli

📖 使用方法

1. 交互式探索模式

直接运行命令,进入主菜单:

js-helper

操作流程

  1. 选择对象:使用上下箭头键选择你想查看的对象(例如 Date)。
  2. 浏览成员:查看该对象的所有成员列表。列表右侧会显示简要的中文注释,让你一眼看懂每个方法的作用。
  3. 查看详情:选中某个成员(例如 Date.prototype.toISOString),按回车查看详细文档。

2. 快速直达模式

如果你已经知道目标对象的名字,可以跳过主菜单:

# 查看 localStorage 的所有方法
js-helper localStorage

# 查看 Document 对象 不区分大小写用document也行的
js-helper Document

# 查看 Array 对象
js-helper Array

3. 查看支持列表

列出所有可供查看的对象名称:

js-helper --list

🖼️ 示例展示

查看成员列表

当你选择 localStorage 时,你会看到类似下面的列表,清晰展示了方法来源和功能:

查看 localStorage 的成员详情
1. [静态属性] Symbol(impl) - undefined  // localStorage 的静态属性...
2. [Storage.prototype 方法] key(arg0) - method  // 返回数组中第 n 个键的名称。
3. [Storage.prototype 方法] getItem(arg0) - method  // 返回键名对应的值。
4. [Storage.prototype 方法] setItem(arg0, arg1) - method  // 添加键和值,如果对应的值存在,则更新...
5. [Storage.prototype 方法] removeItem(arg0) - method  // 从存储中删除该键名。
6. [Storage.prototype 方法] clear() - method  // 清空存储对象中所有的键值对。
...

查看详细文档

选中 setItem 后,你将获得详尽的说明:

================ 详情 ================

name: setItem
kind: method
parameters: 2
...

功能说明: 添加键和值,如果对应的值存在,则更新该键对应的值。
使用说明: storage.setItem(keyName, keyValue)
使用注意:
- keyValue 会被自动转换为字符串。
- 如果存储空间已满,可能会抛出 QuotaExceededError 异常。

======================================

🛠️ 支持的对象(部分)

JS Helper CLI 支持数百个内置对象,包括但不限于:

  • Standard Objects: Array, Object, String, Number, Boolean, Date, Math, JSON, Promise, Proxy, Reflect, RegExp, Symbol, Map, Set ...
  • Web APIs: Window, Document, Location, History, Navigator, localStorage, sessionStorage, console, crypto, performance, XMLHttpRequest, URL, Blob, File ...
  • Typed Arrays: Int8Array, Uint8Array, Float32Array ...
  • Errors: Error, TypeError, SyntaxError ...

💻 本地开发

如果你想参与贡献或在本地修改代码:

  1. 克隆仓库

    git clone https://github.com/your-username/js-helper-cli.git
    cd js-helper-cli
  2. 安装依赖

    npm install
  3. 运行测试

    # 进入交互模式
    npm start
    
    # 测试特定对象
    npm start -- localStorage

📄 License

MIT © [Your Name]