
Security News
Socket for Origin Now Available
Socket for Origin scans dependency changes in pull requests and flags security risks based on your team’s policies. Now available in Cursor’s App Marketplace.
@gaubee/util
Advanced tools
@std/* 互为补充。
这个库中与 @std 系列有一些交集,交集的部分通常是我个人觉得我自己的实现更好:
- 可能是性能上更好
- 可能是使用体验上更易用好用
- 可能是条件边界覆盖更全。
install:
npm install @gaubee/util
pnpm install @gaubee/util
yarn install @gaubee/util
deno add @gaubee/util
bun add @gaubee/util
usage:
注意,本项目没有副作用了,对 Tree-Shaking 支持良好,你可以直接 import 一整个包,最终 bundle 的时候,只会包含你实际使用的部分。
import { delay } from "@gaubee/util";
@std/* 互为补充。
这个库中与 @std 系列有一些交集,交集的部分通常是我个人觉得我自己的实现更好:
- 可能是性能上更好
- 可能是使用体验上更易用好用
- 可能是条件边界覆盖更全。
例如 Promise.withResolvers
abort_signal_merge:
(..._signals: (AbortSignal | undefined | null)[]) => AbortSignal | undefinedarr_set_next:
(arr: Array<T>, item: T) => voidsparse_arr_get_first:
<T>(arr: ArrayLike<T>) => Tsparse_arr_get_first_or_null:
<T>(arr: ArrayLike<T>) => T | undefinedsparse_arr_get_first_or_default:
<T, R>(arr: ArrayLike<T>, defaultValue: () => R) => T | Rarr_get_first:
<T>(arr: ArrayLike<T>) => Tarr_get_first_or_null:
<T>(arr: ArrayLike<T>) => T | undefinedarr_get_first_or_default:
<T, R>(arr: ArrayLike<T>, defaultValue: () => R) => T | Rsparse_arr_get_last:
<T>(arr: ArrayLike<T>) => Tsparse_arr_get_last_or_null:
<T>(arr: ArrayLike<T>) => T | undefinedsparse_arr_get_last_or_default:
<T, R>(arr: ArrayLike<T>, defaultValue: () => R) => T | Rarr_get_last:
<T>(arr: ArrayLike<T>) => Tarr_get_last_or_null:
<T>(arr: ArrayLike<T>) => T | undefinedarr_get_last_or_default:
<T, R>(arr: ArrayLike<T>, defaultValue: () => R) => T | Rarr_remove_first:
<T>(arr: T[], value: T) => numberbigint_gcd:
(left: bigint, right: bigint) => bigintdate_clone:
(date: Date) => DateDuration:
type Duration = { year: number; month: number; day: number; minutes: number; seconds: number; milliseconds: number; }date_add_duration:
(date: Date, duration: Partial<Duration>) => Datedate_to_duration:
(date: Date) => Durationdate_set_duration:
(date: Date, duration: Partial<Duration>) => DateFormatifyDate:
type FormatifyDate = { ... }date_formatify:
(date: string | number | Date) => FormatifyDatedate_format:
(format: string, date: string | number | Date) => stringfunc_debounce:
<T extends Func>(fn: T, wait: number | Timmer = 0, options: { before?: boolean }) => DebouncedFunction<T>isPending, cancel, source, flush 方法。DebouncedFunction: 带有额外控制方法的函数类型FAQs
一些常见的pure-js工具函数,适用于任何场景
The npm package @gaubee/util receives a total of 467 weekly downloads. As such, @gaubee/util popularity was classified as not popular.
We found that @gaubee/util demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
Socket for Origin scans dependency changes in pull requests and flags security risks based on your team’s policies. Now available in Cursor’s App Marketplace.

Security News
Agent Baseline’s new reference architecture shows how to secure software factories with four boundaries enforced outside the AI agent.

Security News
arXiv now limits authors to two submissions a month as AI slop overwhelms moderators, delays good papers, and sparks debate over applying the limit to everyone.