node-cooper - v0.2.0
    Preparing search index...

    Class export=

    A CASC duration (CASC.md ยง6.8) -- 500ms, 1h30m, !duration("5m"). Mirrors the Elixir implementation's {:duration, nanoseconds}: nanoseconds are the base unit, held as a bigint so that every literal the spec allows is represented exactly (a few hundred days already exceeds Number.MAX_SAFE_INTEGER nanoseconds).

    JS has no native duration type (Temporal isn't broadly available), so the conversion helpers target plain numbers: toMilliseconds() (what setTimeout and most Node APIs take), toSeconds(), and the matching Duration.fromMilliseconds()/fromSeconds() constructors.

    Index
    nanoseconds: bigint
    • Returns string

      the base-unit form, e.g. "500000000ns" -- valid CASC if fed back in

    • Parses duration literal text ("1h30m", "1.5s"), with the same rules and errors as a bare literal in a CASC file.

      Parameters

      • text: string

      Returns Duration