Skip to content

Commit 933ec2f

Browse files
committed
chore: prettier
1 parent f41f71b commit 933ec2f

10 files changed

+95
-77
lines changed

Diff for: .github/workflows/ci.yml

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
name: CI
2-
on:
3-
push:
4-
branches:
5-
- main
6-
pull_request:
7-
jobs:
8-
CI:
9-
name: CI
10-
runs-on: "ubuntu-latest"
11-
strategy:
12-
fail-fast: true
13-
matrix:
14-
node: [16, 18]
15-
steps:
16-
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
17-
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
18-
with:
19-
node-version: ${{ matrix.node }}
20-
- run: npm ci
21-
- run: npm test
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
jobs:
8+
CI:
9+
name: CI
10+
runs-on: "ubuntu-latest"
11+
strategy:
12+
fail-fast: true
13+
matrix:
14+
node: [16, 18]
15+
steps:
16+
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
17+
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
18+
with:
19+
node-version: ${{ matrix.node }}
20+
- run: npm ci
21+
- run: npm test

Diff for: .prettierc.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

Diff for: README.md

+18-17
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
# fetch-undici-polyfill
2-
3-
Polyfill fetch with [undici](https://github.com/nodejs/undici) implementation on NodeJS.
4-
5-
## Usage
6-
7-
Install: `npm i fetch-undici`
8-
9-
Code:
10-
```js
11-
// ESM import
12-
import 'fetch-undici';
13-
// CJS require
14-
require('fetch-undici');
15-
16-
fetch('https://nyan.cat');
17-
```
1+
# fetch-undici-polyfill
2+
3+
Polyfill fetch with [undici](https://github.com/nodejs/undici) implementation on NodeJS.
4+
5+
## Usage
6+
7+
Install: `npm i fetch-undici`
8+
9+
Code:
10+
11+
```js
12+
// ESM import
13+
import "fetch-undici";
14+
// CJS require
15+
require("fetch-undici");
16+
17+
fetch("https://nyan.cat");
18+
```

Diff for: index.cjs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const { fetch } = require("undici");
2-
3-
if (!Object.keys(global).includes("fetch")) {
4-
Object.defineProperty(global, "fetch", { value: fetch });
5-
}
1+
const { fetch } = require("undici");
2+
3+
if (!Object.keys(global).includes("fetch")) {
4+
Object.defineProperty(global, "fetch", { value: fetch });
5+
}

Diff for: index.d.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { fetch as fetchUndici } from "undici";
2-
declare global {
3-
var fetch: typeof fetchUndici;
4-
}
1+
import type { fetch as fetchUndici } from "undici";
2+
declare global {
3+
var fetch: typeof fetchUndici;
4+
}

Diff for: index.mjs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { fetch } from "undici";
2-
3-
if (!Object.keys(global).includes("fetch")) {
4-
Object.defineProperty(global, "fetch", { value: fetch });
5-
}
1+
import { fetch } from "undici";
2+
3+
if (!Object.keys(global).includes("fetch")) {
4+
Object.defineProperty(global, "fetch", { value: fetch });
5+
}

Diff for: package-lock.json

+17-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"undici": "latest"
3030
},
3131
"devDependencies": {
32-
"fetch-undici-polyfill": "file:."
32+
"fetch-undici-polyfill": "file:.",
33+
"prettier": "^2.8.3"
3334
}
3435
}

Diff for: tests/with-polyfill.mjs

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import "fetch-undici-polyfill";
2-
import { test } from "node:test";
3-
import assert from "node:assert";
4-
5-
6-
test("fetch exists", () => {
7-
assert(typeof fetch !== "undefined");
8-
});
1+
import "fetch-undici-polyfill";
2+
import { test } from "node:test";
3+
import assert from "node:assert";
4+
5+
test("fetch exists", () => {
6+
assert(typeof fetch !== "undefined");
7+
});

Diff for: tests/without-polyfill.mjs

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import { test } from "node:test";
2-
import assert from "node:assert";
3-
4-
const versionMatcher = /^v(?<major>\d*).(?<minor>\d*).(?<patch>\d*)$/;
5-
6-
const isNodeVersionLgt18 = () =>
7-
parseInt(versionMatcher.exec(process.version).groups.major) >= 18;
8-
9-
isNodeVersionLgt18()
10-
? test("fetch exists", () => {
11-
assert(typeof fetch !== "undefined");
12-
})
13-
: test("fetch does not exists", () => {
14-
assert(typeof fetch === "undefined");
15-
});
1+
import { test } from "node:test";
2+
import assert from "node:assert";
3+
4+
const versionMatcher = /^v(?<major>\d*).(?<minor>\d*).(?<patch>\d*)$/;
5+
6+
const isNodeVersionLgt18 = () =>
7+
parseInt(versionMatcher.exec(process.version).groups.major) >= 18;
8+
9+
isNodeVersionLgt18()
10+
? test("fetch exists", () => {
11+
assert(typeof fetch !== "undefined");
12+
})
13+
: test("fetch does not exists", () => {
14+
assert(typeof fetch === "undefined");
15+
});

0 commit comments

Comments
 (0)