-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Antoni Kepinski
committed
May 17, 2020
0 parents
commit fcea04c
Showing
9 changed files
with
184 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = tab | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Sketch temporary file | ||
~*.sketch | ||
|
||
# Generated files | ||
dist/ | ||
|
||
# Logs | ||
logs | ||
*.log | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like nyc and istanbul | ||
.nyc_output | ||
coverage | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directory | ||
# Commenting this out is preferred by some people, see | ||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- | ||
node_modules | ||
|
||
# Users Environment Variables | ||
.lock-wscript | ||
|
||
# OS files | ||
.DS_Store | ||
|
||
# Babel-compiled files | ||
lib | ||
|
||
# Ignore package manager lock files | ||
package-lock.json | ||
yarn.lock | ||
|
||
# Ignore IDE | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package-lock=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
language: node_js | ||
|
||
node_js: | ||
- "lts/*" # Latest LTS | ||
- "node" # Latest Stable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
|
||
import fetch from 'node-fetch'; | ||
|
||
if (!global.fetch) { | ||
global.fetch = fetch; | ||
} | ||
|
||
if (!global.Headers) { | ||
global.Headers = fetch.Headers; | ||
} | ||
|
||
if (!global.Request) { | ||
global.Request = fetch.Request; | ||
} | ||
|
||
if (!global.Response) { | ||
global.Response = fetch.Response; | ||
} | ||
|
||
export default fetch; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import fetch from 'node-fetch'; | ||
|
||
export = fetch; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
|
||
const fetch = require('node-fetch'); | ||
|
||
if (!global.fetch) { | ||
global.fetch = fetch; | ||
} | ||
|
||
if (!global.Headers) { | ||
global.Headers = fetch.Headers; | ||
} | ||
|
||
if (!global.Request) { | ||
global.Request = fetch.Request; | ||
} | ||
|
||
if (!global.Response) { | ||
global.Response = fetch.Response; | ||
} | ||
|
||
module.exports = fetch; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"name": "@node-fetch/universal", | ||
"version": "1.0.0", | ||
"description": "Universal node-fetch wrapper", | ||
"main": "index.js", | ||
"module": "esm.js", | ||
"browser": "esm.js", | ||
"sideEffects": false, | ||
"exports": { | ||
"import": "esm.js", | ||
"require": "index.js" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"esm.js", | ||
"*.d.ts" | ||
], | ||
"engines": { | ||
"node": ">=10" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/node-fetch/universal.git" | ||
}, | ||
"keywords": [ | ||
"fetch", | ||
"http", | ||
"promise", | ||
"node-fetch", | ||
"universal", | ||
"isomorphic", | ||
"cross-fetch", | ||
"isomorphic-fetch", | ||
"browser-fetch" | ||
], | ||
"author": "Antoni Kepinski <[email protected]> (https://kepinski.me)", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/node-fetch/universal/issues" | ||
}, | ||
"homepage": "https://github.com/node-fetch/universal", | ||
"funding": { | ||
"type": "opencollective", | ||
"url": "https://opencollective.com/node-fetch" | ||
}, | ||
"devDependencies": { | ||
"ava": "^3.8.2", | ||
"node-fetch": "^3.0.0-beta.5", | ||
"xo": "^0.30.0" | ||
}, | ||
"peerDependencies": { | ||
"node-fetch": ">=3.0.0-beta.5" | ||
}, | ||
"xo": { | ||
"envs": [ | ||
"node", | ||
"browser" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const test = require('ava'); | ||
const fetch = require('.'); | ||
|
||
test('main', async t => { | ||
const response = await fetch('https://httpbin.org/json'); | ||
const {slideshow} = await response.json(); | ||
|
||
t.is(slideshow.title, 'Sample Slide Show'); | ||
}); |