MCPcopy
hub / github.com/Effect-TS/effect / DurationFromNanos

Class DurationFromNanos

packages/effect/src/Schema.ts:5918–5930  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5916 * @since 3.10.0
5917 */
5918export class DurationFromNanos extends transformOrFail(
5919 NonNegativeBigIntFromSelf.annotations({ description: "a bigint to be decoded into a Duration" }),
5920 DurationFromSelf.pipe(filter((duration) => duration_.isFinite(duration), { description: "a finite duration" })),
5921 {
5922 strict: true,
5923 decode: (i) => ParseResult.succeed(duration_.nanos(i)),
5924 encode: (a, _, ast) =>
5925 option_.match(duration_.toNanos(a), {
5926 onNone: () => ParseResult.fail(new ParseResult.Type(ast, a, `Unable to encode ${a} into a bigint`)),
5927 onSome: (nanos) => ParseResult.succeed(nanos)
5928 })
5929 }
5930).annotations({ identifier: "DurationFromNanos" }) {}
5931
5932/**
5933 * A non-negative integer. +Infinity is excluded.

Callers

nothing calls this directly

Calls 5

transformOrFailInterface · 0.85
filterFunction · 0.70
annotationsMethod · 0.65
pipeMethod · 0.65
failMethod · 0.65

Tested by

no test coverage detected