{"name":"@lazy-array/util-unique","version":"1.0.2","keywords":["create-by-yarn-tool","create-by-tsdx"],"author":{"name":"bluelovers"},"license":"ISC","_id":"@lazy-array/util-unique@1.0.2","maintainers":[{"name":"bluelovers","email":"codelovers@users.sourceforge.net"}],"homepage":"https://github.com/bluelovers/ws-array/tree/master/packages/@lazy-array/util-unique#readme","bugs":{"url":"https://github.com/bluelovers/ws-array/issues"},"dist":{"shasum":"8bc2af58622113a5cd4659319fea42809ef39002","tarball":"http://registry-npm.ywwl.com/@lazy-array/util-unique/download/@lazy-array/util-unique-1.0.2.tgz","fileCount":16,"integrity":"sha512-pMeu3Fp0QKgrBr0v2uOvwDy5XYv1juvAeyQRwfbeH1SBhyPZOIBsQ+MHMuj5D1OdHJRXNHsQplgiUnixCtX5vA==","signatures":[{"sig":"MEYCIQC74hx2OHeUHtyXGo0OaB5ddPUg5qf400/vX75XwK7cagIhAPKfdMgUeaV1tKdInpwmceA3ylS7DL54n09GlFJ7P802","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":8904,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjMjEoACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrCqA/+Lx5s9/XLFekPGFGFXGA56+GGhyf9NsHcNZKocSGqOf426Q2o\r\nt0Er3QrOkAJLX6S0h7vDI2FZu6FPWAVAJaWd4rg5l+uI8FBii7FcHAafxJYf\r\nWnolpVOFLBiPyub1XM01scCgoPE8Yv0ZqXHpoDlH33Bxob5+cJ3V5kV/rfr9\r\nLXmGkR1O8rTQ6TLWZLrw1+oJSWA6JS/vVkp/EL4NoC4gAiY1tZw4dtpEw64h\r\ns22HF2ggWYy3gprInVmG+pN7ESthBIi2zKfF7bxROPuKFmel2EZ21ivvOY7u\r\n4UB0cNciOyKTd9kpX/mojIHlMC0tXTpohIhtm2aLu7yGHF7LgI2AweWvypHW\r\nFQsa73s+QcRAIaJhZJLfKWq5EVXSqBfKpRbbgKkaXR0Ks1ILOr164iMPuTV8\r\naJVf/bXKWPM4c4ibtGQLzuzdTgshUXDAg043N4EWR7aHAxIPVp2xn286WvKO\r\nuxGKxIzaIVJ64ziK4oVTUnE/u2ka5FeBdHu7+SvrC18nmsoJM60iOCxS1tBL\r\nLbIkKY/TNWuAGUY2C9liShgb/6sxT5Beb8iZltONNQe55vpLjmo8Tzog8OCE\r\n00+c3jJjNMwKBIcFKi/sipttO3pRaLwKxlXwu/N7czpeCJABF+yeUQhZx33K\r\nv8vILmfmjE7rxORYWSavJKW98okC5l9XUXc=\r\n=37Cn\r\n-----END PGP SIGNATURE-----\r\n","size":3003,"noattachment":false,"key":"/@lazy-array/util-unique/-/@lazy-array/util-unique-1.0.2.tgz"},"main":"dist/index.cjs","types":"dist/index.d.ts","unpkg":"dist/index.umd.production.min.cjs","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":"fcebb3831d3a25e50d06481d9d4e9a56b3d3036d","scripts":{"ncu":"yarn-tool ncu -u","lint":"yarn run lint:eslint","pack":"echo pack","test":"jest --passWithNoTests","build":"yarn run build:tsdx && yarn run build:dts:bundle","review":"yarn run review:coverage","prepack":"echo prepack","prepare":"echo prepare","pretest":"echo pretest","publish":"echo publish","version":"echo version","ci:build":"echo ci:build","coverage":"yarn run test -- --coverage","postpack":"echo postpack","posttest":"yarn run build","test:tsd":"ynpx tsd","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 && yarn 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":"yarn run lint && yarn run test","build:dts:tsc":"yarn run build:dts:tsc:emit && yarn run build:dts:copy","test:snapshot":"yarn 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":"yarn run lint && yarn run coverage","build:dts:bundle":"ynpx 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:snapshot":"yarn run test:jest -- -u","prepublishOnly:update":"yarn run ncu && yarn run sort-package-json"},"typings":"dist/index.d.ts","_npmUser":{"name":"bluelovers","email":"codelovers@users.sourceforge.net"},"repository":{"url":"git+https://github.com/bluelovers/ws-array.git","type":"git","directory":"packages/@lazy-array/util-unique"},"_npmVersion":"lerna/5.5.1/node@v18.9.0+x64 (win32)","description":"","directories":{},"sideEffects":false,"_nodeVersion":"18.9.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"yarn@1.22.19","_npmOperationalInternal":{"tmp":"tmp/util-unique_1.0.2_1664233768400_0.3375831888932095","host":"s3://npm-registry-packages"},"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":1664233768642,"_cnpm_publish_time":1664233768642,"dist-tags":{"latest":"1.0.9"}}