JavaScript Less indentation


Example

With promises:

function doTheThing() {
    return doOneThing()
        .then(doAnother)
        .then(doSomeMore)
        .catch(handleErrors)
}

With async functions:

async function doTheThing() {
    try {
        const one = await doOneThing();
        const another = await doAnother(one);
        return await doSomeMore(another);
    } catch (err) {
        handleErrors(err);
    }
}

Note how the return is at the bottom, and not at the top, and you use the language's native error-handling mechanics (try/catch).