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

@micl/constant

v0.0.1

Published

micl constant

Readme

@micl/constant

npm version npm downloads license

Micl 项目的常量定义模块,提供统一的枚举和常量配置,确保项目中常量的一致性和可维护性。

📦 安装

npm install @micl/constant
# or
pnpm add @micl/constant
# or
yarn add @micl/constant

📚 模块导出

TASK_STATUS_ENUM

任务状态枚举,定义了任务的各种状态码:

| 状态 | 值 | 描述 | 类型 | |------|-----|------|------| | NotFound | 0 | 任务不存在 | 系统状态 | | Created | 1 | 任务已创建 | 系统状态 | | Pending | 2 | 任务等待中 | 系统状态 | | Stopping | 3 | 任务停止中 | 系统状态 | | Completed | 4 | 任务已完成 | 系统状态 | | Failed | 5 | 任务失败 | 系统状态 | | Pause | 12 | 任务暂停 | 用户操作 | | Abort | 13 | 任务中止 | 用户操作 | | Delete | 99 | 任务删除 | 用户操作 |

🎯 使用示例

基本使用

import { TASK_STATUS_ENUM } from '@micl/constant';

// 检查任务状态
if (task.status === TASK_STATUS_ENUM.Completed) {
  console.log('任务已完成');
}

// 状态判断
function getStatusText(status: number): string {
  const statusMap: Record<number, string> = {
    [TASK_STATUS_ENUM.NotFound]: '任务不存在',
    [TASK_STATUS_ENUM.Created]: '任务已创建',
    [TASK_STATUS_ENUM.Pending]: '任务等待中',
    [TASK_STATUS_ENUM.Stopping]: '任务停止中',
    [TASK_STATUS_ENUM.Completed]: '任务已完成',
    [TASK_STATUS_ENUM.Failed]: '任务失败',
    [TASK_STATUS_ENUM.Pause]: '任务暂停',
    [TASK_STATUS_ENUM.Abort]: '任务中止',
    [TASK_STATUS_ENUM.Delete]: '任务删除',
  };
  
  return statusMap[status] || '未知状态';
}

类型安全

import { TASK_STATUS_ENUM } from '@micl/constant';

// TypeScript 类型推断
const status: TASK_STATUS_ENUM = TASK_STATUS_ENUM.Pending;

// 类型安全的状态检查
function processTask(status: TASK_STATUS_ENUM): void {
  switch (status) {
    case TASK_STATUS_ENUM.Completed:
      // 处理完成状态
      break;
    case TASK_STATUS_ENUM.Failed:
      // 处理失败状态
      break;
    // 其他状态处理...
  }
}

🛠 开发

构建

# 进入 constant 目录
cd constant

# 构建项目
yarn build

# 或使用 npm
npm run build

代码质量

# 代码检查
yarn lint

# 代码格式化
yarn format

📁 项目结构

constant/
├── core.ts        # 核心常量定义
├── index.ts       # 模块导出
├── package.json   # 包配置
├── rollup.config.js  # 构建配置
└── yarn.lock      # 依赖锁文件

🤝 贡献

欢迎提交 Issue 和 Pull Request 来完善这个模块。

📄 许可证

本项目采用 ISC 许可证 - 查看 LICENSE 文件了解详情。

📞 支持

如有问题或建议,请提交 Issue 或联系维护者。


@micl/constant - 统一常量管理,简化开发流程 🚀