MCPcopy Index your code
hub / github.com/Effect-TS/effect / make

Function make

packages/effect/src/Duration.ts:184–202  ·  view source on GitHub ↗
(input: number | bigint)

Source from the content-addressed store, hash-verified

182} as const
183
184const make = (input: number | bigint): Duration => {
185 const duration = Object.create(DurationProto)
186 if (isNumber(input)) {
187 if (isNaN(input) || input <= 0) {
188 duration.value = zeroValue
189 } else if (!Number.isFinite(input)) {
190 duration.value = infinityValue
191 } else if (!Number.isInteger(input)) {
192 duration.value = { _tag: "Nanos", nanos: BigInt(Math.round(input * 1_000_000)) }
193 } else {
194 duration.value = { _tag: "Millis", millis: input }
195 }
196 } else if (input <= bigint0) {
197 duration.value = zeroValue
198 } else {
199 duration.value = { _tag: "Nanos", nanos: input }
200 }
201 return duration
202}
203
204/**
205 * @since 2.0.0

Callers 9

Duration.tsFile · 0.70
nanosFunction · 0.70
microsFunction · 0.70
millisFunction · 0.70
secondsFunction · 0.70
minutesFunction · 0.70
hoursFunction · 0.70
daysFunction · 0.70
weeksFunction · 0.70

Calls 2

isNumberFunction · 0.85
createMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…