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

Function nonNegative

packages/effect/src/ui/Query.ts:2682–2694  ·  view source on GitHub ↗
(
  name: string,
  field: string,
  input: Duration.Input
)

Source from the content-addressed store, hash-verified

2680const quote = (name: string): string => JSON.stringify(name)
2681
2682const nonNegative = (
2683 name: string,
2684 field: string,
2685 input: Duration.Input
2686): number => {
2687 const duration = Duration.fromInputUnsafe(input)
2688 if (Duration.isNegative(duration)) {
2689 throw new Error(
2690 "[Query] " + quote(name) + ": " + field + " can't be negative"
2691 )
2692 }
2693 return Duration.toMillis(duration)
2694}
2695
2696const subSecondHint = "A bare number is milliseconds: write a sub-second interval as a Duration string, such as " +
2697 "\"500 millis\"."

Callers 1

makeDefFunction · 0.70

Calls 1

quoteFunction · 0.70

Tested by

no test coverage detected