javascript return boolean from async function