Socket
Socket
Sign inDemoInstall

@js-bits/fetch

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@js-bits/fetch

Cross-environment (nodejs/web) fetch API


Version published
Weekly downloads
139
increased by12.1%
Maintainers
1
Weekly downloads
 
Created
Source

Cross-environment (nodejs/web) fetch APi

This package exports window.fetch object in a browser and node-fetch module in a Node.js environment. Which is helpful when you develop a package compatible with both environments and use fetch for HTTP requests. Allows to avoid conditional imports.

Installation

Install with npm:

npm install @js-bits/fetch

Install with yarn:

yarn add @js-bits/fetch

Import where you need it:

import fetch from '@js-bits/fetch';

How to use

fetch('http://example.com/movies.json')
  .then(response => response.json())
  .then(data => console.log(data));

Notes

  • Fetch API
  • node-fetch

Keywords

FAQs

Package last updated on 26 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc