From 4a27acf389b9e7da4554f5caa6abb33789b407f0 Mon Sep 17 00:00:00 2001 From: Christoffer Bjelke <56649743+chribjel@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:55:54 +0200 Subject: [PATCH] Update README.md --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 889d96f1..66c6e043 100644 --- a/README.md +++ b/README.md @@ -802,7 +802,7 @@ const result = Result.combineWithAllErrors(resultList) #### `Result.safeUnwrap()` -**⚠️ You must use `.safeUnwrap` in a generator context with `safeTry`**. Please see [safeTry](#safeTry). +**⚠️ If you are using version 8.0.0 or earlier, you must use `.safeUnwrap` in a generator context with `safeTry`**. Please see [safeTry](#safeTry). Allows for unwrapping a `Result` or returning an `Err` implicitly, thereby reducing boilerplate. @@ -1412,7 +1412,7 @@ const result = ResultAsync.combineWithAllErrors(resultList) #### `ResultAsync.safeUnwrap()` -**⚠️ You must use `.safeUnwrap` in a generator context with `safeTry`**. Please see [safeTry](#safeTry). +**⚠️ If you are using version 8.0.0 or earlier, you must use `.safeUnwrap` in a generator context with `safeTry`**. Please see [safeTry](#safeTry). Allows for unwrapping a `Result` or returning an `Err` implicitly, thereby reducing boilerplate. @@ -1493,12 +1493,12 @@ function myFunc(): Result { // Otherwise, this `(yield* ...)` is evaluated to its `.value`. (yield* mayFail1() .mapErr(e => `aborted by an error from 1st function, ${e}`) - .safeUnwrap()) + // .safeUnwrap()) ⚠️ You must use this for version 8.0.0 or earlier + // The same as above. (yield* mayFail2() .mapErr(e => `aborted by an error from 2nd function, ${e}`) - .safeUnwrap()) + // .safeUnwrap()) ⚠️ You must use this for version 8.0.0 or earlier ) }) } @@ -1521,12 +1521,12 @@ function myFunc(): Promise> { // You have to await if the expression is Promise (yield* (await mayFail1()) .mapErr(e => `aborted by an error from 1st function, ${e}`) - .safeUnwrap()) + // .safeUnwrap()) ⚠️ You must use this for version 8.0.0 or earlier + // You can call `safeUnwrap` directly if its ResultAsync (yield* mayFail2() .mapErr(e => `aborted by an error from 2nd function, ${e}`) - .safeUnwrap()) + // .safeUnwrap()) ⚠️ You must use this for version 8.0.0 or earlier ) }) }