Skip to content

Commit

Permalink
docs(ensurePromise): add ensurePromise section to README
Browse files Browse the repository at this point in the history
  • Loading branch information
lambdalisue committed Aug 20, 2024
1 parent 3e8aef7 commit 23ff9c5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ worker(2);
worker(3);
```

### ensurePromise

`ensurePromise` is a utility function that ensures a value is a promise.

```ts
import { ensurePromise } from "@core/asyncutil/ensure-promise";

const p1 = ensurePromise(Promise.resolve("Resolved promise"));
console.log(await p1); // Resolved promise

const p2 = ensurePromise("Not a promise");
console.log(await p2); // Not a promise
```

### Lock/RwLock

`Lock` is a mutual exclusion lock that provides safe concurrent access to a
Expand Down

0 comments on commit 23ff9c5

Please sign in to comment.