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

Function parseNanos

packages/effect/src/Duration.ts:91–92  ·  view source on GitHub ↗
(input: string, scale: number)

Source from the content-addressed store, hash-verified

89const DURATION_REGEX = /^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/
90
91const parseNanos = (input: string, scale: number): bigint =>
92 input.includes(".") ? BigInt(Math.round(Number(input) * scale)) : BigInt(input) * BigInt(scale)
93
94/**
95 * @since 2.0.0

Callers 1

decodeFunction · 0.85

Calls 1

NumberInterface · 0.85

Tested by

no test coverage detected