Skip to main content
Deno 2 is finally here 🎉️
Learn more

Unique Array (Deno)

⚖️ MIT CodeFactor Grade

Release - Latest Release - Pre
GitHub GitHub Latest Release Version (GitHub Latest Release Date) GitHub Latest Pre-Release Version (GitHub Latest Pre-Release Date)

A Deno module to return unique array elements without any duplicated elements by ignore their reference points.

🔰 Begin

Deno

  • Target Version: >= v1.34.0
  • Require Permission: N/A
  • Domain/Registry:
    • Deno Land
      import ... from "https://deno.land/x/unique_array[@<Tag>]/mod.ts";
    • DenoPKG
      import ... from "https://denopkg.com/hugoalh-studio/unique-array-deno[@<Tag>]/mod.ts";
    • GitHub Raw [Require Tag]
      import ... from "https://raw.githubusercontent.com/hugoalh-studio/unique-array-deno/<Tag>/mod.ts";
    • Pax
      import ... from "https://pax.deno.dev/hugoalh-studio/unique-array-deno[@<Tag>]/mod.ts";

ℹ️ Notice: Although it is recommended to import main module with path mod.ts in general, it is also able to import part of the module with sub path if available, but do not import if:

  • it’s file path has an underscore prefix (e.g.: _foo.ts, _util/bar.ts), or
  • it is a benchmark or test file (e.g.: foo.bench.ts, foo.test.ts), or
  • it’s symbol has an underscore prefix (e.g.: export function _baz() {}).

These elements are not considered part of the public API, thus no stability is guaranteed for them.

🧩 API

  • function uniqueArray<T>(item: T[]): T[];

ℹ️ Notice: Documentation is included inside the script file, can view it via:

✍️ Example

  • import { uniqueArray } from "https://raw.githubusercontent.com/hugoalh-studio/unique-array-deno/main/mod.ts";
    
    uniqueArray([{ foo: "bar" }, { foo: "bar" }, { bar: "gaz" }]);
    //=> [{ foo: "bar" }, { bar: "gaz" }]

🔗 Other Edition