• Groups the list into sub-lists when adjacent elements are equal.

    Type Parameters

    • T

    Parameters

    • equalityT: PartialEq<T, T>

      The equality for T.

    Returns ((list) => List<List<T>>)

    The list of grouped sub-list.

    Examples

    import { fromString, group, toArray, toString } from "./list.ts";
    import * as Option from "./option.ts";
    import { assertEquals } from "../deps.ts";
    import { strict } from "./type-class/partial-eq.ts";

    const grouped = toArray(group(strict<string>())(fromString("Mississippi")))
    .map((list) => toString(list));
    assertEquals(grouped, ["M", "i", "ss", "i", "ss", "i", "pp", "i"]);

Generated using TypeDoc