-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Almost done with adding docs to the utils, rework certain things and …
…move the chain promise utils to functions
- Loading branch information
1 parent
3f22827
commit 3049f17
Showing
32 changed files
with
701 additions
and
386 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { tcp } from './tcp.js' | ||
|
||
/** | ||
* The `cafs` function stands for `call async functions sequentially`. It executes a list of async functions in sequence. | ||
*/ | ||
export async function cafs(...fns: ((...args: any[]) => Promise<any>)[]): Promise<void> { | ||
for (let fn of fns) { | ||
await tcp(() => fn()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { tcp } from './tcp.js' | ||
|
||
/** | ||
* The `cafsue` function stands for `call async functions sequentially until error`. It executes a list of async functions in sequence, the execution stops if a function throws or returns an error. | ||
*/ | ||
export async function cafsue(...fns: ((...args: any[]) => Promise<any>)[]): Promise<void> { | ||
let output: unknown | Error | ||
|
||
for (let fn of fns) { | ||
output = await tcp(() => fn()) | ||
if (output instanceof Error) return | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { tcp } from './tcp.js' | ||
|
||
/** | ||
* The `cafsueof` function stands for `call async functions sequentially until error or falsy`. It executes a list of async functions in sequence, the execution stops if a function throws or returns an error or a falsy value. | ||
*/ | ||
export async function cafsueof(...fns: ((...args: any[]) => Promise<any>)[]): Promise<boolean> { | ||
let output: boolean | Error | ||
|
||
for (let fn of fns) { | ||
output = await tcp(() => fn()) | ||
if (output instanceof Error) return false | ||
|
||
output = Boolean(output) | ||
if (!output) return false | ||
} | ||
|
||
return true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.