npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@lazy-array/array-hyper-unique-decorator

v1.0.3

Published

為方法提供陣列深度去重裝飾器,支援同步和異步模式 / Provides array deep deduplication decorators for methods, supporting synchronous and asynchronous modes

Downloads

101

Readme

@lazy-array/array-hyper-unique-decorator

為方法提供陣列深度去重裝飾器,支援同步和異步模式。

Provides array deep deduplication decorators for methods, supporting synchronous and asynchronous modes.

功能說明 / Features

  • ArrayUniqueDecorator: 同步陣列去重裝飾器
  • ArrayUniqueOverwriteDecorator: 同步覆寫模式去重裝飾器
  • ArrayUniqueAsyncDecorator: 異步陣列去重裝飾器
  • ArrayUniqueOverwriteAsyncDecorator: 異步覆寫模式去重裝飾器

安裝 / Install

yarn add @lazy-array/array-hyper-unique-decorator
yarn-tool add @lazy-array/array-hyper-unique-decorator
yt add @lazy-array/array-hyper-unique-decorator

使用範例 / Usage Examples

同步裝飾器 / Synchronous Decorator

import { ArrayUniqueDecorator } from '@lazy-array/array-hyper-unique-decorator';

class DataService {
  @ArrayUniqueDecorator()
  getItems() {
    return [
      { id: 1, name: 'Alice' },
      { id: 1, name: 'Alice' },
      { id: 2, name: 'Bob' }
    ];
  }
}

const service = new DataService();
console.log(service.getItems());
// => [{ id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }]

異步裝飾器 / Async Decorator

import { ArrayUniqueAsyncDecorator } from '@lazy-array/array-hyper-unique-decorator';

class ApiService {
  @ArrayUniqueAsyncDecorator()
  async fetchUsers() {
    // 模擬 API 請求
    return Promise.resolve([
      { id: 1, name: 'Alice' },
      { id: 1, name: 'Alice' },
      { id: 2, name: 'Bob' }
    ]);
  }
}

const api = new ApiService();
api.fetchUsers().then(users => {
  console.log(users);
  // => [{ id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }]
});

應用情境 / Application Scenarios

  1. API 資料處理: 自動去除 API 回傳的重複資料
  2. 快取管理: 確保快取資料的唯一性
  3. 表單驗證: 處理使用者提交的重複選項
  4. 資料聚合: 合併多個資料源後進行去重

與 array-hyper-unique 的關係 / Relationship with array-hyper-unique

此套件基於 array-hyper-unique 實現,提供裝飾器形式的使用方式。

This package is built on top of array-hyper-unique, providing decorator-based usage.

API 參考 / API Reference

查看完整 API