Module

x/jssm/jssm_util.d.ts>unique

Fast, easy Javascript finite state machines with visualizations; enjoy a one liner FSM instead of pages. MIT; Typescripted; 100% test coverage. Implements the FSL language.
Go to Latest
variable unique
import { unique } from "https://dotland.deno.dev/x/jssm@5.98.0/jssm_util.d.ts";

Reduces an array to its unique contents. Compares with === and makes no effort to deep-compare contents; two matching arrays or objects contained will be treated as distinct, according to javascript rules. This also means that NaNs will be dropped, because they do not self-compare.

unique( [] );                     // []
unique( [0,0] );                  // [0]
unique( [0,1,2, 0,1,2, 0,1,2] );  // [0,1,2]
unique( [ [1], [1] ] );           // [ [1], [1] ] because arrays don't match
unique( [0,NaN,2] );              // [0,2]

type

<T>(arr?: T[]) => T[]