Skip to main content
Module

x/itertools/more-itertools.ts>uniqueJustseen

🦕 A TypeScript port of Python's itertools and more-itertools for Deno
Go to Latest
function uniqueJustseen
import { uniqueJustseen } from "https://deno.land/x/itertools@v1.1.1/more-itertools.ts";

Yields elements in order, ignoring serial duplicates.

>>> [...uniqueJustseen('AAAABBBCCDAABBB')]
['A', 'B', 'C', 'D', 'A', 'B']
>>> [...uniqueJustseen('AbBCcAB', s => s.toLowerCase())]
['A', 'b', 'C', 'A', 'B']

Parameters

iterable: Iterable<T>
optional
keyFn: (v: T) => Primitive = [UNSUPPORTED]

Returns

Iterable<T>