From c318048ba15a5ac0d05e6c8ff7bcd8532fcaa5f8 Mon Sep 17 00:00:00 2001 From: yifanwww Date: Sun, 2 Jun 2024 23:43:58 +0800 Subject: [PATCH] feat: no need to call unwrapUnchecked or unwrapErrUnchecked inside Result --- src/Result.class.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Result.class.ts b/src/Result.class.ts index 6e61919..08083ef 100644 --- a/src/Result.class.ts +++ b/src/Result.class.ts @@ -100,28 +100,28 @@ export class RustlikeResult implements Result { inspect(fn: (value: T) => void): this { if (this.isOk()) { - fn(this.unwrapUnchecked()); + fn(this._value!); } return this; } async inspectAsync(fn: (value: T) => void | Promise): Promise { if (this.isOk()) { - await fn(this.unwrapUnchecked()); + await fn(this._value!); } return this; } inspectErr(fn: (err: E) => void): this { if (this.isErr()) { - fn(this.unwrapErrUnchecked()); + fn(this._error!); } return this; } async inspectErrAsync(fn: (err: E) => void | Promise): Promise { if (this.isErr()) { - await fn(this.unwrapErrUnchecked()); + await fn(this._error!); } return this; }