{"name":"@lazy-array/util-unique","version":"1.0.3","keywords":["create-by-yarn-tool","create-by-tsdx"],"author":{"name":"bluelovers"},"license":"ISC","_id":"@lazy-array/util-unique@1.0.3","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":"010027e0fc22425fe1e86b71bf68490c34f9dffb","tarball":"http://registry-npm.ywwl.com/@lazy-array/util-unique/download/@lazy-array/util-unique-1.0.3.tgz","fileCount":16,"integrity":"sha512-tGrPNdgY1ze3DFFccSB1rOLVEsXJOLkwLEjsIDZlKdr/iBKmjEx3au/VG2+jJL7MdXCF5piqp8uFhkZXEEYwYg==","signatures":[{"sig":"MEYCIQDQBWHX0d6gKPg7fnkq/kFWj3ErjkLO9UoJDkpWM0daMgIhAL5frVM9kj3TjoeMzBku7ePBlOv599cfD2rEU/jm99Da","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9311,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjSeb8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoSzA/+KNFq8m4kodapQc2LNGPtvqz1kMfUf2jv93XUNWuzXTRObzm6\r\nU2efDeOP2pV3cTsx/sE+oeiau9WyQXtaKFQfTP+Ou09JxPu+ibM1CRfhVdQ4\r\nw1Sd/h0Zz7RpwSWFt3ZcfFwwH3CPCtkR+6yJKE8OQxzpINytX+EpggMehvwo\r\n5SahIO1DpDFaK2GDp8LcsbU8q57CUXAD+p8lDzcLG3++lDOhwGmjsUxb75j+\r\nSrw+2871gEnD/PBwCZSAgWOH1WjwaEGcDgZ7aaRiBSQVW5Q8G8nniEphCHpO\r\nnPP+skztirdcb7prajrGvoRtD5rjhVgfbR0m4B3c6zdcHYuRosfQ6Q5CEhV7\r\n6lVTKmnCVEM1PXUHyzcaang5bDsiTO1CbJmP72HmXJGBWLCoQfzZEi5BZn/S\r\nIzIqW4P6LZCvt4LK8p5+YtkbTw/ivcJl/Js7mk1VR2HKeF2SZWEVQwATaDb+\r\nfthIl38gV2IQk6WRDAO8v3Z5MY0RTeqBqWcMRqiyVCSGxffTTbG9BIt4LJcG\r\nqDzwPpw+KFRQ8XKX/8eDUW3b6O/aFHXZBorOFOtXbMJNTGRZW6RYwGxaXEQn\r\nvHVzkOdZ25DLqBAu8WwkCG4Jt9/fA21klBiiVYjCH3smWH4ynu7sOQZX+SV+\r\nwrd51pgpVCpctKJy2c1KxdtQQ1SN5SVdfGM=\r\n=tL7c\r\n-----END PGP SIGNATURE-----\r\n","size":3069,"noattachment":false,"key":"/@lazy-array/util-unique/-/@lazy-array/util-unique-1.0.3.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":"7b52de45e7022cc53fa1411f639b598b824b2cdc","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/6.0.1/node@v18.10.0+x64 (win32)","description":"","directories":{},"sideEffects":false,"_nodeVersion":"18.10.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"yarn@1.22.19","_npmOperationalInternal":{"tmp":"tmp/util-unique_1.0.3_1665787644053_0.11805769939487099","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":1665787644277,"_cnpm_publish_time":1665787644277,"dist-tags":{"latest":"1.0.9"}}