MCPcopy Create free account
hub / github.com/Effect-TS/effect / parseInterval

Function parseInterval

packages/effect/src/ui/Query.ts:2700–2706  ·  view source on GitHub ↗
(input: Duration.Input)

Source from the content-addressed store, hash-verified

2698
2699/** The interval in milliseconds, or why the input isn't one. */
2700const parseInterval = (input: Duration.Input): number | "invalid" => {
2701 if (typeof input === "number" && !(input >= 1000)) return "invalid"
2702 const duration = Duration.fromInput(input)
2703 if (Option.isNone(duration)) return "invalid"
2704 const ms = Duration.toMillis(duration.value)
2705 return ms > 0 ? ms : "invalid"
2706}
2707
2708/**
2709 * Builds a query's data, and throws on what a definition may not say.

Callers 2

makeDefFunction · 0.85
evaluateIntervalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected