def with_reset.at

cswap-bend-cli@0.1.0.0 · usage/norm.bend:47

import cswap-bend-cli@0.1.0.0/usage/norm.bend as Norm
import Base
import cswap-bend-cli@0.1.0.0/json.bend as Json

47# resets_at, then countdown and clock when the stamp parses.
48def with_reset.at(j: Json.Json, s: String, t: Maybe<&2, U32>, +now: U32, +off: U32) -> Json.Json:
49  match t:
50    case None{}:
51      Json.set("resets_at", Json.JStr{s}, j)
52    case Some{+u}:
53      Json.set("clock", Json.JStr{clock.text(u, now, off)},
54        Json.set("countdown", Json.JStr{countdown(remaining(u, now))},
55          Json.set("resets_at", Json.JStr{s}, j)))

Uses (8)

Used by (1)