• Repeats the succ operation until pred returns true.

    Type Parameters

    • T

    Parameters

    • pred: ((t) => boolean)

      The predicate whether the operation is done.

        • (t): boolean
        • Parameters

          • t: T

          Returns boolean

    Returns ((succ) => ((init) => T))

    The found value while operations.

    Examples

    import { assertEquals } from "../deps.ts";
    import { until } from "./func.ts";

    const padLeft = until((x: string) => 4 <= x.length)((x) => "0" + x);
    assertEquals(padLeft(""), "0000");
    assertEquals(padLeft("1"), "0001");
    assertEquals(padLeft("13"), "0013");
    assertEquals(padLeft("131"), "0131");
    assertEquals(padLeft("1316"), "1316");
    assertEquals(padLeft("1316534"), "1316534");
      • (succ): ((init) => T)
      • Parameters

        • succ: ((t) => T)
            • (t): T
            • Parameters

              • t: T

              Returns T

        Returns ((init) => T)

          • (init): T
          • Parameters

            • init: T

            Returns T

Generated using TypeDoc