npm

Bring the best of OSS JavaScript development to your projects with npm Orgs - private packages & team management tools.Learn more »

isomorphic-unfetch

3.0.0 • Public • Published

Isomorphic Unfetch

Switches between unfetch & node-fetch for client & server.

Install

This project uses node and npm. Go check them out if you don't have them locally installed.

$ npm install --save isomorphic-unfetch

Then with a module bundler like rollup or webpack, use as you would anything else:

// using ES6 modules
import fetch from 'isomorphic-unfetch'
 
// using CommonJS modules
var fetch = require('isomorphic-unfetch')

Usage

As a ponyfill:

import fetch from 'isomorphic-unfetch';
 
fetch('/foo.json')
  .then( r => r.json() )
  .then( data => {
    console.log(data);
  });

Globally, as a polyfill:

import 'isomorphic-unfetch';
 
// "fetch" is now installed globally if it wasn't already available
 
fetch('/foo.json')
  .then( r => r.json() )
  .then( data => {
    console.log(data);
  });

License

MIT License © Jason Miller

Keywords

none

install

npm i isomorphic-unfetch

Downloadsweekly downloads

118,585

version

3.0.0

license

none

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability