{"_id":"@lazy-array/util-unique@1.0.9","bugs":{"url":"https://github.com/bluelovers/ws-array/issues"},"dist":{"shasum":"ba40a3b28d86e48a9f2a817741ec7d2b2f54cfb3","tarball":"http://registry-npm.ywwl.com/@lazy-array/util-unique/download/@lazy-array/util-unique-1.0.9.tgz","fileCount":16,"integrity":"sha512-Wx8hBIkjIXCPKBfoLjXzlwktdlMA84qrSDE7xE0QLGRWGGbInl9+ZIWpy0Ny0tdL6S1qsT9P8ccqHuGsQ3tq2Q==","signatures":[{"sig":"MEUCIQCM80fhXW3U2G6pzuTtePUOrvB7xXCyV5NTzASRcSnLNwIgPgtwohaGQVU9c6QPbqDf5Ge1uOYE/4SvLWEch8K6Y1E=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIB5O+LufCSH12Kx+LDPkX95joG5rstVrOUfRowsJwxeOAiEA/5N4w42kOQMHffAgJ5sVR2q/VcQbglX1Q3HLLwi7LWs="}],"unpackedSize":30487,"size":6508,"noattachment":false,"key":"/@lazy-array/util-unique/-/@lazy-array/util-unique-1.0.9.tgz"},"main":"dist/index.cjs","name":"@lazy-array/util-unique","types":"dist/index.d.ts","unpkg":"dist/index.umd.production.min.cjs","author":{"name":"bluelovers"},"module":"dist/index.esm.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.esm.mjs","require":"./dist/index.cjs"},"./src/*":"./src/*","./package.json":"./package.json"},"gitHead":"9d6f6c235933231c2b859e779d8b2fdde2ba6d47","license":"ISC","scripts":{"ncu":"yarn-tool ncu -u","lint":"pnpm run lint:eslint","pack":"echo pack","test":"echo jest --passWithNoTests","build":"pnpm run build:tsdx && pnpm run build:dts:tsc","review":"pnpm run review:coverage","prepack":"echo prepack","prepare":"echo prepare","pretest":"echo pretest","publish":"echo publish","version":"echo version","ci:build":"echo ci:build","coverage":"pnpm run test --coverage","postpack":"echo postpack","posttest":"pnpm run build","test:tsd":"tsd --files **/*.test-d.ts","test:jest":"jest --passWithNoTests","test:tsdx":"ynpx @bluelovers/tsdx test --passWithNoTests","build:tsdx":"ynpx @bluelovers/tsdx build --target node --name index","ci:install":"echo ci:install","prepublish":"echo prepublish","preversion":"echo preversion && pnpm run test","test:mocha":"ynpx --quiet -p ts-node -p mocha mocha -- --require ts-node/register \"!(node_modules)/**/*.{test,spec}.{ts,tsx}\"","lint:eslint":"ynpx eslint --ext .ts,.tsx,.mts,.cts ./","postpublish":"echo postpublish","postversion":"echo postversion","review:test":"pnpm run lint && pnpm run test","build:dts:tsc":"pnpm run build:dts:tsc:emit & pnpm run build:dts:copy","test:snapshot":"pnpm run test -u","build:dts:copy":"copy .\\src\\index.d.ts .\\dist\\index.d.ts & echo build:dts","prepublishOnly":"echo prepublishOnly","tsc:showConfig":"ynpx get-current-tsconfig -p","postpublishOnly":"echo postpublishOnly","review:coverage":"pnpm run lint && pnpm run coverage","build:dts:bundle":"ynpx @bluelovers/dts-bundle-generator -o ./dist/index.d.ts ./src/index.ts --no-banner --inline-declare-global & echo build:dts:bundle","build:microbundle":"ynpx microbundle --target node","sort-package-json":"yarn-tool sort","build:dts:tsc:emit":"tsc --emitDeclarationOnly --declaration --noEmit false","test:jest:coverage":"pnpm run test:jest --coverage","test:jest:snapshot":"pnpm run test:jest -u","prepublishOnly:update":"pnpm run ncu && pnpm run sort-package-json"},"typings":"dist/index.d.ts","version":"1.0.9","_npmUser":{"name":"bluelovers","email":"codelovers@users.sourceforge.net"},"homepage":"https://github.com/bluelovers/ws-array/tree/master/packages/@lazy-array/util-unique#readme","keywords":["create-by-yarn-tool","create-by-tsdx"],"repository":{"url":"git+https://github.com/bluelovers/ws-array.git","type":"git","directory":"packages/@lazy-array/util-unique"},"_npmVersion":"lerna/7.4.2/node@v26.7.0+x64 (win32)","description":"提供陣列去重的工具函式，包含 indexOf 和 Set 兩種實現方式 / Provides array deduplication utilities with indexOf and Set implementation methods","directories":{},"maintainers":[{"name":"bluelovers","email":"codelovers@users.sourceforge.net"}],"sideEffects":false,"_nodeVersion":"26.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/util-unique_1.0.9_1791818135327_0.32794760786865806"},"readme":"# @lazy-array/util-unique\n\n提供陣列去重的工具函式，包含兩種實現方式。\n\nProvides array deduplication utilities with two implementation methods.\n\n## 功能說明 / Features\n\n- **array_unique_indexOf**: 使用 indexOf 過濾方式取得唯一值 / Get unique values using indexOf filter\n- **array_unique_by_set**: 使用 Set 資料結構取得唯一值 / Get unique values using Set data structure\n\n## 安裝 / Install\n\n```bash\nyarn add @lazy-array/util-unique\nyarn-tool add @lazy-array/util-unique\nyt add @lazy-array/util-unique\n```\n\n## 使用範例 / Usage Examples\n\n### array_unique_indexOf\n\n使用 indexOf 過濾，保留第一個出現的元素。\n\nUses indexOf filter, keeping the first occurrence of each element.\n\n```typescript\nimport { array_unique_indexOf } from '@lazy-array/util-unique';\n\n// 基本使用\nconst result = array_unique_indexOf([1, 2, 2, 3]);\nconsole.log(result); // => [1, 2, 3]\n\n// 字串陣列\nconst strings = array_unique_indexOf(['a', 'b', 'a', 'c']);\nconsole.log(strings); // => ['a', 'b', 'c']\n```\n\n### array_unique_by_set\n\n使用 Set 資料結構，高效能去重。\n\nUses Set for high-performance deduplication.\n\n```typescript\nimport { array_unique_by_set } from '@lazy-array/util-unique';\n\nconst result = array_unique_by_set([1, 2, 2, 3]);\nconsole.log(result); // => [1, 2, 3]\n\nconst objects = array_unique_by_set([{a: 1}, {a: 1}, {b: 2}]);\nconsole.log(objects); // => [{a: 1}, {a: 1}, {b: 2}] - 物件無法透過 Set 去重 / Objects cannot be deduplicated by Set\n```\n\n## 應用情境 / Application Scenarios\n\n1. **資料預處理**: 在處理 API 回傳資料前去除重複項目\n2. **表單驗證**: 檢查使用者輸入的重複值\n3. **資料分析**: 計算唯一值數量\n4. **陣列合併**: 合併多個陣列並去除重複\n\n## 比較 / Comparison\n\n| 方法 / Method | 效能 / Performance | 適用場景 / Use Case |\n|-------------|-------------------|-------------------|\n| array_unique_indexOf | O(n²) | 簡單類型、需保留第一個位置 |\n| array_unique_by_set | O(n) | 大多數場景、高效能需求 |\n\n## API 參考 / API Reference\n\n[查看完整 API](index.d.ts)\n","publish_time":1791818135413,"_cnpm_publish_time":1791818135413,"dist-tags":{"latest":"1.0.9"}}