asyncawait-fetch

0.2.0 • Public • Published

asyncawait-fetch

async/await wrapper around GitHub's Fetch polyfill.

Dependencies

Usage

asyncawait-fetch can be used as a drop in replacement for fetch by importing the library as a named alias import, i.e.

import { asyncawaitFetch as fetch } from 'asyncawait-fetch'
 
async function basicExample () {
  return await fetch(`/users.json`)
}
 
async function optionsExample () {
  return await fetch(`/users`, {
    method: `post`,
    body: new FormData(form)
  })
}
 
async function overrideExample () {
  return await fetch(`/users.html`, null, `json`)
}

License

Released under the MIT license: opensource.org/licenses/MIT

/asyncawait-fetch/

    Package Sidebar

    Install

    npm i asyncawait-fetch

    Weekly Downloads

    5

    Version

    0.2.0

    License

    MIT

    Last publish

    Collaborators

    • chrisdwheatley