{"name":"@lazy-array/util-unique","version":"1.0.1","keywords":["create-by-yarn-tool","create-by-tsdx"],"author":{"name":"bluelovers"},"license":"ISC","_id":"@lazy-array/util-unique@1.0.1","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":"77914932c599fe064d2203315bb96e87f9c61b19","tarball":"http://registry-npm.ywwl.com/@lazy-array/util-unique/download/@lazy-array/util-unique-1.0.1.tgz","fileCount":16,"integrity":"sha512-kMckIKrGfLgoA50kuMn5saaswQa5jNITASyX+3T5rU+kU8eEouw75hKxX27BFCf8Q8yZNpDq6OnH2pTWfYqdlg==","signatures":[{"sig":"MEQCIEEow3h91aEA4wXSQWN6ngR9iloUO4i5fQ7OIs66NQINAiAGii4mb/avPvJcoda6CYwd5XGUm+L+MT+0I7ZsEKLhQw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":8606,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjMPZaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoruhAAl56nCkjSY7ltrufP8C/vfWdVLUtSIJfxMe7BtF/X/Al9aLi4\r\nk5qL6aKIYeEk1t4BdJkQKvZ4GauUngT0jDVJjYiG2+ITVbGpIrRNTBMZ1P/w\r\nzcSF5Y/hzp3H2Kc8LgjBpwf5IGtxXOh8ejPbzA/UBLORykxWQYSTCA2e06Ar\r\nH7yjfoTSrV8uykvuCU2ZPaLPFiZkuOZjlbhJZOYOm65AS86H3gI/B9UCIht2\r\nAWdKrPpcz4tsUwFY0/MooooLoJwRUCXNED7Qc+swA6VljAvwkGj/gHooHYnx\r\nt3gaalXARsfO0zCHs5tdCtRLjJDbeK60O/GA7Ymt96WOkXRg4EK5hOMOI6XS\r\nqVNAlxf1c6CIMZ9joPyASmOt+Sbow2AEPSJJTUJMFGnN1/lI0I/PBuXG4SGX\r\nURFwt00YBOcUUAgCgsT+d5vzMLTlSTnQ3wyIFeHF9jVY5rlkkf5lrj7J7vrP\r\n9U9QlVhH93AL9SvA2rVDTwuju+tFFjPooek0t4zV9UDcQjRLs+lfEBi84ylF\r\nez7QM92D7TGR4i9GAkmPGBb4SDWoVou1TbkqbabXW2hCXLLeIyt45uJ/cATw\r\nu9QYCvS2ydZ/4mitHe0QyGcB0tB097EPFLnyVgH6YIz5DAuO4HSekeiphuwB\r\nAjlWot859T/NaWOWNPTRjtipT/7W7ObU+dY=\r\n=20vX\r\n-----END PGP SIGNATURE-----\r\n","size":2909,"noattachment":false,"key":"/@lazy-array/util-unique/-/@lazy-array/util-unique-1.0.1.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":"1847cf5e4d64c410da4934e8c7bc2de2f2df0960","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: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.1_1664153178615_0.7022003587773815","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":1664153178792,"_cnpm_publish_time":1664153178792,"dist-tags":{"latest":"1.0.9"}}