The predicate whether the operation is done.
The found value while operations.
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");
Generated using TypeDoc
Repeats the
succ
operation untilpred
returnstrue
.