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

@koishi-ce/utils

v1.1.1

Published

Utilities for Koishi

Readme

@koishi-ce/utils

简体中文 | English

Koishi 的通用工具函数集合,移植自上游 koishijs/koishi 的 packages/utils。不依赖 Koishi 运行时,任何 Node 侧包都可以安全引用;核心包将其全量再导出,插件作者通常经 @koishi-ce/core 间接获得这些工具。

主要导出

再导出 cosmokit 全部工具、is 类型守卫(别名 isType)与 inaba 随机数库的 Random,另含三个自有模块:

  • misc.ts:sleep、enumKeys、merge、coerce(字符串到原始类型的强转)、extend(原型方法混入)、defineEnumProperty 等杂项工具;
  • observe.ts:observe() 与 Observed<T>——基于 Proxy 的深度变更追踪:对普通对象取观察者,变更记录在 $diff,$update() 取出差量交回调消费。minato ORM「取出实体、修改、落盘差量」的更新机制即由此实现;
  • string.ts:interpolate——Koishi 配置中 ${{ expr }} 与 {{ expr }} 表达式插值的底层实现;escapeRegExp。

用法

import { observe, sleep, interpolate } from "@koishi-ce/utils";

const user = observe({ name: "Koishi" }, () => console.log("changed"));
user.name = "CE";
user.$update();

许可证

MIT。本包是上游 koishijs/koishi 的社区再分发,版权归属见 NOTICE。


English

A collection of general-purpose utilities for Koishi, ported from packages/utils of the upstream koishijs/koishi. It has no dependency on the Koishi runtime and can be imported safely by any Node-side package; @koishi-ce/core re-exports all of it, so plugin authors usually get these tools transitively.

Key exports

Re-exports all of cosmokit, the is type guards (aliased isType) and the Random library, plus three home-grown modules:

  • misc.ts — sleep, enumKeys, merge, coerce (string-to-primitive casting), extend (prototype mixin), defineEnumProperty and more.
  • observe.ts — observe() / Observed<T>: Proxy-based deep change tracking. Changes are recorded into $diff; $update() consumes the diff through a callback. This is the mechanism behind minato's "fetch entity, mutate, persist the diff" updates.
  • string.ts — interpolate, the engine behind the ${{ expr }} / {{ expr }} interpolation in Koishi configs; plus escapeRegExp.

Usage

import { observe, sleep, interpolate } from "@koishi-ce/utils";

const user = observe({ name: "Koishi" }, () => console.log("changed"));
user.name = "CE";
user.$update();

License

MIT. Community redistribution of upstream koishijs/koishi; see NOTICE for attribution.