News for hackers. Stuff that matters.
Re:Better Promises in JavaScript by zebracanevra on Monday September 24, 2018 @10:48AM (#18058139)
fetch's Response.text also returns a Promise, so you'd have to await twice:

  const lines = (await (await fetch(myUrl)).text()).split('\n');
Re:Better Promises in JavaScript by mikewhy on Monday September 24, 2018 @03:38PM (#18060734)
I've always just added an overload:

    function fetchText(input?: string | Request, init?: RequestInit) {
      return fetch(input, init).then(x => x.text())
    }

    function fetchJson(input?: string | Request, init?: RequestInit) {
      return fetch(input, init).then(x => x.json())
    }
Re:Better Promises in JavaScript by mnr on Monday September 24, 2018 @11:16AM (#18058376)
Shucks, I can see how it becomes verbose.