UNPKG

wtf_wikipedia

Version:
16 lines (15 loc) 411 B
const unfetch = require('isomorphic-unfetch') /** * use the native client-side fetch function * * @private * @param {string} url the url that well be fetched * @param {RequestInit} opts the options for fetch * @returns {Promise<any>} the response from fetch */ const request = function (url, opts) { return unfetch(url, opts).then(function (res) { return res.json() }) } module.exports = request