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

@doki-land/dejavu-engine

v0.0.0

Published

DejaVu Engine - 模板引擎

Readme

DejaVu Tools (TypeScript)

Déjà-Vu 模板引擎的 TypeScript 工具库,提供各种通用的工具函数、类型定义、错误处理和配置管理功能。

定位

  • TypeScript 工具库:提供 DejaVu 前端开发所需的通用工具
  • 完整的工具集:包含工具函数、错误处理、配置管理等
  • 核心功能
    • 通用工具函数(空值检查、延迟、重试等)
    • 类型定义(文件路径、环境变量等)
    • 错误处理系统
    • 事件发射器
    • 缓存系统
    • 配置管理

特性

  • 完全 TypeScript 编写,类型安全
  • 零运行时依赖
  • 模块化设计,按需导入
  • 提供丰富的工具函数
  • 完整的错误处理机制
  • 事件驱动架构支持

使用

安装

pnpm add dejavu-tools

基本示例

import {
  isNil,
  isEmpty,
  delay,
  deepClone,
  uuidv4,
  EventEmitter,
  Cache,
  ErrorLevel,
  ToolException,
  createDefaultToolsConfig,
  ToolsConfigManager
} from 'dejavu-tools';

// 使用工具函数
if (isNil(value)) {
  console.log('值为空');
}

// 使用事件发射器
const emitter = new EventEmitter();
emitter.on('data', (data) => console.log(data));
emitter.emit('data', 'hello');

// 使用缓存
const cache = new Cache<string, number>(60000);
cache.set('key', 123);
console.log(cache.get('key'));

工具函数列表

空值检查

  • isNil - 检查值是否为 null 或 undefined
  • isNotNil - 检查值不为 null 或 undefined
  • isEmpty - 检查值是否为空
  • isNotEmpty - 检查值不为空

异步工具

  • delay - 延迟执行
  • cancellableDelay - 可取消的延迟
  • retry - 重试操作
  • debounce - 防抖函数
  • throttle - 节流函数
  • memoize - 记忆化函数

对象工具

  • deepClone - 深拷贝
  • deepEqual - 深比较
  • safeJsonParse - 安全的 JSON 解析
  • safeJsonStringify - 安全的 JSON 序列化

字符串工具

  • uniqueId - 生成唯一 ID
  • uuidv4 - 生成 UUID v4
  • capitalize - 首字母大写
  • camelCase - 驼峰命名
  • kebabCase - 短横线命名
  • snakeCase - 下划线命名
  • truncate - 截断字符串

数组工具

  • unique - 数组去重
  • chunk - 数组分块

模块结构

  • types - 类型定义
  • errors - 错误处理
  • utils - 工具函数
  • options - 配置和选项

依赖关系

dejavu-tools (TypeScript) 是一个独立的前端工具库,无外部依赖。