wait
Returns a promise that resolves after how many milliseconds you pass it. Great for waiting any amount of time. If you do not pass it any value, it will immediately resolve. This is handy when you need to ensure the following code is put at the end of the JS event callstack.
API
function wait(amount = 0): Promise<NodeJS.Timeout>;
Usage
import { wait } from "@feedzai/js-utilities";
async function doStuff() {
doSomething();
await wait(); // does not wait
doSomethingElse();
await wait(2000); // waits 2 seconds
console.log('2000ms later');
}