
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.
import { cafsueof } from '@aracna/core';
(async () => {
let number;
await cafsueof(
async () => number++,
async () => new Error(),
async () => number++
);
// will log 1
console.log(number);
await cafsueof(
async () => number++,
async () => false,
async () => number++
);
// will log 2
console.log(number);
})();