MCPcopy Create free account
hub / github.com/Effect-TS/effect / [Hash.symbol]

Function [Hash.symbol]

packages/effect/src/Duration.ts:353–366  ·  view source on GitHub ↗
(this: Duration)

Source from the content-addressed store, hash-verified

351const DurationProto: Omit<Duration, "value"> = {
352 [TypeId]: TypeId,
353 [Hash.symbol](this: Duration) {
354 // Hash equal finite durations using the same canonical nanoseconds
355 // representation used by `equals`.
356 switch (this.value._tag) {
357 case "Millis": {
358 const nanos = this.value.millis * 1_000_000
359 return Number.isFinite(nanos) ? Hash.hash(roundTiesAwayFromZero(nanos)) : Hash.number(this.value.millis)
360 }
361 case "Nanos":
362 return Hash.hash(this.value.nanos)
363 default:
364 return Hash.structure(this.value)
365 }
366 },
367 [Equal.symbol](this: Duration, that: unknown): boolean {
368 return isDuration(that) && equals(this, that)
369 },

Callers

nothing calls this directly

Calls 1

roundTiesAwayFromZeroFunction · 0.85

Tested by

no test coverage detected