{"_id":"@c6i/es-sential","_rev":"3-435e313d9ecc8c4608bc9852db11148a","name":"@c6i/es-sential","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"@c6i/es-sential","version":"0.1.0","author":{"name":"c6i","email":"chuenwei0129@gmail.com"},"license":"MIT","_id":"@c6i/es-sential@0.1.0","maintainers":[{"name":"c6i","email":"chuenwei0129@gmail.com"}],"dist":{"shasum":"f2c893ab30a7bc800f5c3315e63d6728cff430e9","tarball":"https://registry.npmjs.org/@c6i/es-sential/-/es-sential-0.1.0.tgz","fileCount":38,"integrity":"sha512-Z0wa2/AsD3Ed4TVkOUpxhVinzBhIxr5rTmMVwHJ4uGDcPPFgcz9ndXg2HKjT2VIg6yRbP4zKnN8083J2VBI8zA==","signatures":[{"sig":"MEYCIQCAl8F+pT8/Wv9IrQy0I2rI5knwtDPowuDyCIQ03zblrQIhANV5JJbwdbcoUjvIliRZAq23FDomYkgcJ7wz7S3Lli6h","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30196},"main":"./dist/index.cjs","type":"module","_from":"file:c6i-es-sential-0.1.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./array":{"import":{"types":"./dist/array/index.d.ts","default":"./dist/array/index.js"},"require":{"types":"./dist/array/index.d.cts","default":"./dist/array/index.cjs"}},"./object":{"import":{"types":"./dist/object/index.d.ts","default":"./dist/object/index.js"},"require":{"types":"./dist/object/index.d.cts","default":"./dist/object/index.cjs"}},"./string":{"import":{"types":"./dist/string/index.d.ts","default":"./dist/string/index.js"},"require":{"types":"./dist/string/index.d.cts","default":"./dist/string/index.cjs"}},"./package.json":"./package.json"},"scripts":{"dev":"tsup --watch","lint":"biome check .","test":"vitest","build":"tsup","format":"biome format . --write","release":"pnpm run build && changeset publish","test:ci":"vitest run","lint:fix":"biome check . --write","changeset":"changeset","typecheck":"tsc --noEmit","test:types":"vitest typecheck","version-packages":"changeset version"},"_npmUser":{"name":"c6i","email":"chuenwei0129@gmail.com"},"_resolved":"/private/var/folders/z9/cln7y9vx6wg83399sf00g7yc0000gn/T/482dd75b2d79bb065e86707437f78325/c6i-es-sential-0.1.0.tgz","_integrity":"sha512-Z0wa2/AsD3Ed4TVkOUpxhVinzBhIxr5rTmMVwHJ4uGDcPPFgcz9ndXg2HKjT2VIg6yRbP4zKnN8083J2VBI8zA==","_npmVersion":"11.9.0","description":"现代 JavaScript/TypeScript 工具函数库","directories":{},"lint-staged":{"*.{ts,js}":["biome check --write","biome format --write"],"*.{json,md}":["biome format --write"]},"sideEffects":false,"_nodeVersion":"24.14.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","husky":"^9.1.7","vitest":"^4.1.2","publint":"^0.3.18","typescript":"^6.0.2","lint-staged":"^16.4.0","@biomejs/biome":"^2.4.10","@changesets/cli":"^2.30.0"},"_npmOperationalInternal":{"tmp":"tmp/es-sential_0.1.0_1774946279541_0.8696949380618031","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@c6i/es-sential","version":"0.2.0","keywords":[],"author":{"name":"c6i","email":"chuenwei0129@gmail.com"},"license":"MIT","_id":"@c6i/es-sential@0.2.0","maintainers":[{"name":"c6i","email":"chuenwei0129@gmail.com"}],"homepage":"https://github.com/chuenwei0129/es-sential#readme","bugs":{"url":"https://github.com/chuenwei0129/es-sential/issues"},"dist":{"shasum":"a4add2b48fb0b1bcba0b5cf8e6a1684a0511e19f","tarball":"https://registry.npmjs.org/@c6i/es-sential/-/es-sential-0.2.0.tgz","fileCount":8,"integrity":"sha512-pHAvSZS0uYm4z1o7N70viMgbW9rxqiZYyNuqQgzWFAu57eZimdg2XGQN8dmVfRvJ2yKOPms9hkI5TusaroH9FA==","signatures":[{"sig":"MEUCIFxUjaswVc0/T4btPiejyTb4nULhFdM3O8HLshdl+zzRAiEA66YB7RTjJDLPkceVsR0rSRjY6qreLUK4kiTa7mMvGWU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":25068},"main":"./dist/index.cjs","type":"module","_from":"file:c6i-es-sential-0.2.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"dev":"tsup --watch","lint":"eslint .","test":"vitest run","build":"tsup","check":"pnpm typecheck && pnpm format:check && pnpm lint && pnpm test","clean":"rm -rf dist","format":"prettier --write .","lint:fix":"eslint . --fix","typecheck":"tsc --noEmit","test:watch":"vitest","format:check":"prettier --check .","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"c6i","email":"chuenwei0129@gmail.com"},"_resolved":"/private/var/folders/z9/cln7y9vx6wg83399sf00g7yc0000gn/T/fd50faa41eabd34fd8d118c0a34460a0/c6i-es-sential-0.2.0.tgz","_integrity":"sha512-pHAvSZS0uYm4z1o7N70viMgbW9rxqiZYyNuqQgzWFAu57eZimdg2XGQN8dmVfRvJ2yKOPms9hkI5TusaroH9FA==","repository":{"url":"git+https://github.com/chuenwei0129/es-sential.git","type":"git"},"_npmVersion":"11.9.0","description":"es-sential 是一个高质量的实用函数库，包含现代 JavaScript 项目中常用的函数。","directories":{},"sideEffects":false,"_nodeVersion":"24.14.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","husky":"^9.1.7","eslint":"^9.23.0","vitest":"^4.1.2","globals":"^16.0.0","prettier":"^3.5.3","@eslint/js":"^9.23.0","typescript":"^5.9.3","lint-staged":"^16.4.0","@changesets/cli":"^2.30.0","typescript-eslint":"^8.29.0","@vitest/coverage-v8":"^4.1.2","@vitest/eslint-plugin":"^1.1.38","eslint-config-prettier":"^10.1.8"},"_npmOperationalInternal":{"tmp":"tmp/es-sential_0.2.0_1775193973976_0.15057625138639952","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@c6i/es-sential","version":"0.3.0","description":"es-sential 是一个高质量的实用函数库，包含现代 JavaScript 项目中常用的函数。","keywords":[],"type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"sideEffects":false,"author":{"name":"c6i","email":"chuenwei0129@gmail.com"},"homepage":"https://github.com/chuenwei0129/es-sential#readme","repository":{"type":"git","url":"git+https://github.com/chuenwei0129/es-sential.git"},"license":"MIT","devDependencies":{"@changesets/cli":"^2.30.0","@eslint/js":"^9.23.0","@vitest/coverage-v8":"^4.1.2","@vitest/eslint-plugin":"^1.1.38","eslint":"^9.23.0","eslint-config-prettier":"^10.1.8","globals":"^16.0.0","husky":"^9.1.7","lint-staged":"^16.4.0","prettier":"^3.5.3","tsup":"^8.5.1","typescript":"^5.9.3","typescript-eslint":"^8.29.0","vitest":"^4.1.2"},"publishConfig":{"access":"public"},"scripts":{"dev":"tsup --watch","build":"tsup","clean":"rm -rf dist","typecheck":"tsc --noEmit","test":"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage","lint":"eslint .","lint:fix":"eslint . --fix","format":"prettier --write .","format:check":"prettier --check .","check":"pnpm typecheck && pnpm format:check && pnpm lint && pnpm test"},"_id":"@c6i/es-sential@0.3.0","bugs":{"url":"https://github.com/chuenwei0129/es-sential/issues"},"_integrity":"sha512-HvBCD9ZGgqk7jpKmCHQ41hU5dETiscnO5pz2w1mIrAVHlke6Qd1Otir8U5yEO3da0YZcpitTAINjh0YSy97Vfw==","_resolved":"/private/var/folders/z9/cln7y9vx6wg83399sf00g7yc0000gn/T/4662042b370024958374afef3d17904d/c6i-es-sential-0.3.0.tgz","_from":"file:c6i-es-sential-0.3.0.tgz","_nodeVersion":"24.14.0","_npmVersion":"11.9.0","dist":{"integrity":"sha512-HvBCD9ZGgqk7jpKmCHQ41hU5dETiscnO5pz2w1mIrAVHlke6Qd1Otir8U5yEO3da0YZcpitTAINjh0YSy97Vfw==","shasum":"47acebb26aa3c0697be3b0589226597eda953ae9","tarball":"https://registry.npmjs.org/@c6i/es-sential/-/es-sential-0.3.0.tgz","fileCount":9,"unpackedSize":38211,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDRz6OgOWQJ/5LeCqcS+fluY+7Nz3tf9WddYvpG0CqnZAIga9RROnCaswAbRJQkPqwRnmKQodLvowJSp4UauW6hAQw="}]},"_npmUser":{"name":"c6i","email":"chuenwei0129@gmail.com"},"directories":{},"maintainers":[{"name":"c6i","email":"chuenwei0129@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/es-sential_0.3.0_1775205376913_0.11426132027993452"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-31T08:37:59.436Z","modified":"2026-04-03T08:36:17.177Z","0.1.0":"2026-03-31T08:37:59.684Z","0.2.0":"2026-04-03T05:26:14.139Z","0.3.0":"2026-04-03T08:36:17.062Z"},"bugs":{"url":"https://github.com/chuenwei0129/es-sential/issues"},"author":{"name":"c6i","email":"chuenwei0129@gmail.com"},"license":"MIT","homepage":"https://github.com/chuenwei0129/es-sential#readme","keywords":[],"repository":{"type":"git","url":"git+https://github.com/chuenwei0129/es-sential.git"},"description":"es-sential 是一个高质量的实用函数库，包含现代 JavaScript 项目中常用的函数。","maintainers":[{"name":"c6i","email":"chuenwei0129@gmail.com"}],"readme":"<h1 align=\"center\">es-sential</h1>\n\n<p align=\"center\">\n<strong>现代 JavaScript/TypeScript 工具库</strong><br/>\n零依赖 · 类型安全 · 按需加载\n</p>\n\n<p align=\"center\">\n<a href=\"https://www.npmjs.com/package/@c6i/es-sential\"><img src=\"https://img.shields.io/npm/v/@c6i/es-sential\" alt=\"npm version\"/></a>\n<img src=\"https://img.shields.io/badge/dependencies-zero-brightgreen\" alt=\"Zero dependencies\"/>\n<img src=\"https://img.shields.io/npm/dm/@c6i/es-sential\" alt=\"Downloads\"/>\n<img src=\"https://img.shields.io/badge/license-MIT-blue\" alt=\"License\"/>\n</p>\n\n<p align=\"center\">\n<a href=\"#快速开始\">快速开始</a> •\n<a href=\"#api-文档\">API 文档</a> •\n<a href=\"#开发路线图\">开发路线图</a> •\n<a href=\"#贡献\">贡献</a>\n</p>\n\n---\n\n## 简介\n\n**es-sential**（essential：必要的）—— 名字的创意既表达了\"这是必需的\"，又巧妙嵌入了\"ES\"（代表 ECMAScript），一语双关。\n\nes-sential 是一个高质量的实用函数库，包含现代 JavaScript 项目中常用的函数。\n\n我们专注于实现那些难以用 JavaScript 内置方法创建，但又经常需要且有用的函数。\n\n我们不实现那些可以轻松被现代 JavaScript 替代的函数，例如：\n\n- `isArray`（改用 `Array.isArray`）\n- `isNaN`（改用 `Number.isNaN`）\n- `isNumber`（改用 `typeof value === 'number'`）\n- `min`（改用 `Math.min()`）\n\n对于 TC39 提案中涵盖的函数，一旦进入 Stage 3，我们将不再实现。\n\n## 特点\n\n- **📝 TypeScript 原生支持** - 完整的类型定义，IDE 智能提示\n- **📦 双格式输出** - ESM + CJS，支持现代 Node.js 和浏览器\n- **🌲 Tree-shaking 友好** - 按需导入，只打包用到的函数\n- **🎯 零依赖** - 无运行时依赖，体积更小\n- **✅ 测试覆盖** - 每个函数都有完整的单元测试\n\n## 快速开始\n\n### 安装\n\n```bash\nnpm install @c6i/es-sential\n# or\npnpm add @c6i/es-sential\n# or\nyarn add @c6i/es-sential\n```\n\n### 使用方式\n\n```typescript\nimport { noop, isSameValueZero } from '@c6i/es-sential'\n\n// 空操作函数 - 作为默认回调\nfunction fetchData(onSuccess = noop, onError = noop) {\n  fetch('/api/data')\n    .then(data => onSuccess(data))\n    .catch(err => onError(err))\n}\n\n// SameValueZero 比较 - 与 Map/Set 内部逻辑一致\nisSameValueZero(NaN, NaN) // true\nisSameValueZero(-0, +0) // true\nisSameValueZero(1, 1) // true\n```\n\n## API 文档\n\n### `noop()`\n\n空操作函数，执行时什么也不做。\n\n**适用场景：**\n\n- 作为默认回调函数，避免调用时需要反复检查 `if (callback)`\n- 作为可选参数的默认值，简化调用方代码\n- 在测试中作为桩（stub）函数\n- 在高阶函数中作为占位符\n\n```typescript\nimport { noop } from '@c6i/es-sential'\n\n// 作为默认回调参数\nfunction startAnimation(onFrame = noop) {\n  let progress = 0\n  requestAnimationFrame(function tick() {\n    progress += 0.1\n    onFrame(progress) // 始终安全，无需检查 undefined\n    if (progress < 1) requestAnimationFrame(tick)\n  })\n}\n\n// 在数组迭代中临时忽略某些元素\nconst arr = [1, 2, 3]\narr.forEach(noop) // 什么都不做，只是遍历\n```\n\n### `isSameValueZero(value, other)`\n\n比较两个值是否相等，使用 **SameValueZero** 算法。\n\n该算法是 JavaScript 中 `Map` 的键比较、`Set` 的值去重所采用的内部相等性判断规则。\n\n| 比较          | `===`   | `Object.is` | `isSameValueZero` |\n| ------------- | ------- | ----------- | ----------------- |\n| `NaN === NaN` | `false` | `true`      | `true`            |\n| `-0 === +0`   | `true`  | `false`     | `true`            |\n| 其他          | 一致    | 一致        | 一致              |\n\n**参数：**\n\n- `value` - 待比较的第一个值\n- `other` - 待比较的第二个值\n\n**返回：** 若两个值满足 SameValueZero 相等则返回 `true`，否则返回 `false`\n\n```typescript\nimport { isSameValueZero } from '@c6i/es-sential'\n\n// 基本类型比较\nisSameValueZero(1, 1) // true\nisSameValueZero('a', 'a') // true\n\n// NaN 比较（SameValueZero 认为 NaN 等于 NaN）\nisSameValueZero(NaN, NaN) // true\n\n// 零值比较（SameValueZero 认为 -0 和 +0 相等）\nisSameValueZero(-0, +0) // true\n\n// 对象比较（引用不同则不等）\nisSameValueZero({}, {}) // false\n\n// 模拟 Map 键比较\nconst map = new Map()\nmap.set(-0, 'minus')\nmap.set(+0, 'plus')\nmap.size // 1，键被覆盖\nisSameValueZero(-0, +0) // true，与 Map 内部逻辑一致\n```\n\n## 开发路线图\n\n**已发布：**\n\n- [x] `noop` - 空操作函数\n- [x] `isSameValueZero` - SameValueZero 相等性比较\n\n**规划中：**\n\n- [ ] Array 工具模块（`chunk`, `uniq`...）\n- [ ] Object 工具模块（`pick`, `omit`...）\n- [ ] String 工具模块（`camelCase`, `kebabCase`...）\n- [ ] Function 工具模块（`debounce`, `throttle`...）\n- [ ] Math 工具模块（`clamp`, `random`...）\n\n## 贡献\n\n欢迎贡献代码、提交 Issue 或建议新功能！\n\n### 开发指南\n\n```bash\n# 安装依赖\npnpm install\n\n# 运行测试\npnpm test\n\n# 构建\npnpm run build\n\n# 代码检查\npnpm run lint\n\n# 类型检查\npnpm run typecheck\n```\n\n### 项目结构\n\n```\nes-sential/\n├── src/\n│   ├── function/      # 函数工具（noop）\n│   ├── utils/         # 通用工具（isSameValueZero）\n│   ├── array/         # 数组工具（待开发）\n│   ├── object/        # 对象工具（待开发）\n│   ├── string/        # 字符串工具（待开发）\n│   └── index.ts       # 主入口\n├── notes/             # 开发笔记\n└── dist/              # 构建输出\n```\n\n查看 [notes/README.md](./notes/README.md) 了解开发过程中的学习心得。\n\n## 许可证\n\n[MIT](./LICENSE) © 2025\n\n---\n\n<p align=\"center\">\n如果这个项目对你有帮助，请给个 ⭐️\n</p>\n","readmeFilename":"README.md"}