Socket
Socket
Sign inDemoInstall

native-fetch

Package Overview
Dependencies
6
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.1 to 3.0.0

dist/src/index.d.ts

9

CHANGELOG.md

@@ -0,1 +1,10 @@

# [3.0.0](https://github.com/achingbrain/native-fetch/compare/v2.0.1...v3.0.0) (2021-02-03)
### Features
* add types ([#2](https://github.com/achingbrain/native-fetch/issues/2)) ([12a35d7](https://github.com/achingbrain/native-fetch/commit/12a35d796745a2a1868a94c668a160fd623aa5dd))
<a name="2.0.1"></a>

@@ -2,0 +11,0 @@ ## [2.0.1](https://github.com/achingbrain/native-fetch/compare/v2.0.0...v2.0.1) (2020-10-06)

18

package.json
{
"name": "native-fetch",
"version": "2.0.1",
"version": "3.0.0",
"description": "Returns native fetch if available or the node-fetch module if not",
"main": "src/index.js",
"types": "dist/src/index.d.ts",
"files": [
"src",
"dist"
],
"scripts": {
"test": "aegir test -t node -t browser -t webworker -t electron-main -t electron-renderer",
"lint": "aegir lint",
"lint": "aegir lint && aegir ts -p check",
"prepare": "aegir build --no-bundle",
"release": "aegir release --docs false",

@@ -19,5 +25,2 @@ "release-minor": "aegir release --type minor --docs false",

},
"dependencies": {
"globalthis": "^1.0.1"
},
"peerDependencies": {

@@ -27,4 +30,5 @@ "node-fetch": "*"

"devDependencies": {
"node-fetch": "^2.6.0",
"aegir": "^26.0.0"
"@types/node-fetch": "^2.5.8",
"aegir": "^30.3.0",
"node-fetch": "^2.6.0"
},

@@ -31,0 +35,0 @@ "contributors": [

@@ -5,3 +5,3 @@ # native-fetch

A drop-in replacement for the `node-fetch` module that returns the native fetch if available or the polyfill if not.
An (almost) drop-in replacement for the `node-fetch` module that returns the native fetch if available or the polyfill if not.

@@ -25,3 +25,3 @@ ### Why?

```javascript
const fetch = require('native-fetch')
const { default: fetch } = require('native-fetch')

@@ -28,0 +28,0 @@ fetch('https://github.com/')

'use strict'
const globalThis = require('globalthis')()
if (globalThis.fetch && globalThis.Headers && globalThis.Request && globalThis.Response) {
module.exports = function fetch (...args) {
return globalThis.fetch(...args)
module.exports = {
default: globalThis.fetch,
Headers: globalThis.Headers,
Request: globalThis.Request,
Response: globalThis.Response
}
module.exports.Headers = globalThis.Headers
module.exports.Request = globalThis.Request
module.exports.Response = globalThis.Response
module.exports.default = module.exports
} else {
module.exports = require('node-fetch')
module.exports = {
default: require('node-fetch').default,
Headers: require('node-fetch').Headers,
Request: require('node-fetch').Request,
Response: require('node-fetch').Response
}
}
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc