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

@jt-home/sdk-tools

v1.3.0

Published

`@jt-home/sdk-tools` 是面向外部项目的聚合入口包,负责统一导出常用认证、请求、路由、事件、时间和宿主环境工具。

Readme

@jt-home/sdk-tools

@jt-home/sdk-tools 是面向外部项目的聚合入口包,负责统一导出常用认证、请求、路由、事件、时间和宿主环境工具。

提供的入口

  • @jt-home/sdk-tools
  • @jt-home/sdk-tools/auth
  • @jt-home/sdk-tools/request-http
  • @jt-home/sdk-tools/event-bus
  • @jt-home/sdk-tools/router

设计目标

  • 对外只装一个包,也能拿到常用的认证、请求、路由和事件能力。
  • 主入口沉淀跨业务的轻量工具能力,例如时区转换和飞书工作台外部浏览器打开。
  • 保留子路径导入,方便按需引用。
  • 入口只做显式导出,不使用 export *

示例

import { createAxios, authRoutePlugin } from "@jt-home/sdk-tools";

const http = createAxios({
  baseURL: "/api",
});

时区工具

接口说明

interface ConvertTimeZoneApi {
  (
    time: string,
    fromTimeZone: string,
    toTimeZone: string,
    format?: string,
    focus?: boolean,
  ): string;
}

interface UtcToLocalTimeApi {
  (
    utcTime: string,
    localTimeZone?: string,
    format?: string,
    focus?: boolean,
  ): string;
}

interface LocalTimeToUtcApi {
  (
    localTime: string,
    localTimeZone?: string,
    format?: string,
    focus?: boolean,
  ): string;
}

参数说明:

  • time / utcTime / localTime:要格式化或转换的时间字符串。
  • fromTimeZone:原始时区,例如 Asia/ShanghaiUTCUTC+08:00
  • toTimeZone / localTimeZone:目标时区或本地时区,例如 America/New_York
  • format:输入和输出共用的格式,默认 YYYY-MM-DD HH:mm:ss
  • focus:日期-only 默认不转换;传 true 时强制转换。
import {
  convertTimeZone,
  getCurrentTimeZone,
  localTimeToUtc,
  utcToLocalTime,
} from "@jt-home/sdk-tools";

getCurrentTimeZone(); // Asia/Shanghai
convertTimeZone("2026/06/09 08:30", "Asia/Shanghai", "America/New_York", "YYYY/MM/DD HH:mm");
utcToLocalTime("2026-06-09 00:30:00", "Asia/Shanghai");
localTimeToUtc("2026-06-09 08:30:00", "Asia/Shanghai");
convertTimeZone("2026-06-09", "Asia/Shanghai", "America/New_York", "YYYY-MM-DD", true);
  • 默认格式为 YYYY-MM-DD HH:mm:ss
  • convertTimeZone 会按传入格式解析输入,并用同一格式输出。
  • 只有日期没有时分秒时默认原样返回;传 focus=true 时会强制转换。
  • 时区支持 IANA 名称(如 Asia/Shanghai)和固定偏移(如 UTC+08:00+08)。

飞书工作台外部浏览器

openFeishuWorkbenchPage(targetUrl, options?) 用于飞书工作台和普通浏览器共用同一套跳转入口。普通浏览器中直接跳转目标页面;飞书工作台内读取 localStorage 里的 refresh_token,拼接 tokensource=feishu_ssolk_jump_to_browser=true 后交给 window.tt.openSchema 在外部浏览器打开。返回结果里的 handled 只表示 SDK 已完成跳转或已交给飞书处理,缺少 refresh_tokenopenSchema 不可用时会返回 handled: false,调用方可继续走原有内部跳转。

import {
  buildFeishuWorkbenchBrowserUrl,
  isFeishuClient,
  openFeishuWorkbenchPage,
} from "@jt-home/sdk-tools";

const result = await openFeishuWorkbenchPage("/hrpt/personnel");
  • isFeishuClient(userAgent?):判断当前 UA 是否来自飞书或 Lark 客户端。
  • buildFeishuWorkbenchBrowserUrl(targetUrl, token, options?):拼接 tokensource=feishu_ssolk_jump_to_browser=true,并按 origin 生成外部浏览器可打开的绝对地址。
  • buildFeishuWorkbenchPageUrl(targetUrl, options?):生成普通浏览器直接跳转地址。
  • openFeishuWorkbenchPage(targetUrl, options?):非飞书环境直接跳转目标页;飞书环境读取 refresh_token 后通过 window.tt.openSchema({ schema: url, external: true }) 打开外部浏览器;失败时返回 handled: false
  • openFeishuWorkbenchBrowser(targetUrl, options?):保留兼容旧名称,行为同 openFeishuWorkbenchPage