MCPcopy Create free account
hub / github.com/effect-app/libs / parseNanos

Function parseNanos

repos/effect/packages/effect/src/Duration.ts:41–42  ·  view source on GitHub ↗
(input: string, scale: bigint)

Source from the content-addressed store, hash-verified

39 BigInt(input < 0 ? Math.ceil(input - 0.5) : Math.floor(input + 0.5))
40
41const roundMillisToNanos = (millis: number): bigint => roundTiesAwayFromZero(millis * 1_000_000)
42
43const parseNanos = (input: string, scale: bigint): bigint => {
44 const decimalIndex = input.indexOf(".")
45 if (decimalIndex === -1) return BigInt(input) * scale

Callers 1

fromInputUnsafeFunction · 0.85

Calls 3

roundTiesAwayFromZeroFunction · 0.85
NumberInterface · 0.70
BigIntInterface · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…