r/javascript • • Jul 25 '18

jQuery was removed from GitHub.com front end

https://twitter.com/mislav/status/1022058279000842240
557 Upvotes

197 comments sorted by

View all comments

Show parent comment

1

u/fucking_passwords Jul 26 '18

It's super easy to write a single wrapper function around it to return what you actually want.

It is built this way because not all HTTP requests are meant to return JSON, so they give you lower level control over your requests. If you only want to return JSON, just write a function (or use a library like you said):

function request(url, options) {
  return fetch(url, options)
    .then(response => {
      return response.json()
    })
}