| 135 | export const isCauseReason = (self: unknown): self is Cause.Reason<unknown> => hasProperty(self, CauseReasonTypeId) |
| 136 | |
| 137 | /** @internal */ |
| 138 | export class CauseImpl<E> implements Cause.Cause<E> { |
| 139 | readonly [CauseTypeId]: typeof CauseTypeId |
| 140 | readonly reasons: ReadonlyArray< |
| 141 | Cause.Fail<E> | Cause.Die | Cause.Interrupt |
| 142 | > |
| 143 | constructor( |
| 144 | failures: ReadonlyArray< |
| 145 | Cause.Fail<E> | Cause.Die | Cause.Interrupt |
| 146 | > |
| 147 | ) { |
| 148 | this[CauseTypeId] = CauseTypeId |
| 149 | this.reasons = failures |
| 150 | } |
| 151 | pipe() { |
| 152 | return pipeArguments(this, arguments) |
| 153 | } |
| 154 | toJSON(): unknown { |
| 155 | return { |
| 156 | _id: "Cause", |
| 157 | failures: this.reasons.map((f) => f.toJSON()) |
| 158 | } |
| 159 | } |
| 160 | toString() { |
| 161 | return `Cause(${format(this.reasons)})` |
| 162 | } |
| 163 | [NodeInspectSymbol]() { |
| 164 | return this.toJSON() |
| 165 | } |
| 166 | [Equal.symbol](that: any): boolean { |
| 167 | return ( |
| 168 | isCause(that) && |
| 169 | this.reasons.length === that.reasons.length && |
| 170 | this.reasons.every((e, i) => Equal.equals(e, that.reasons[i])) |
| 171 | ) |
| 172 | } |
| 173 | [Hash.symbol](): number { |
| 174 | return Hash.array(this.reasons) |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | const annotationsMap = new WeakMap<object, ReadonlyMap<string, unknown>>() |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…