@whatwg-node/fetch 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @whatwg-node/fetch
2
2
 
3
+ ## 0.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`a3bc171`](https://github.com/ardatan/whatwg-node/commit/a3bc17120fbdf641e4363d08ba79955005f5b3d6) Thanks [@ardatan](https://github.com/ardatan)! - fix btoa ponyfill
8
+
3
9
  ## 0.3.0
4
10
 
5
11
  ### Minor Changes
@@ -58,9 +58,12 @@ module.exports = function createNodePonyfill(opts = {}) {
58
58
  }
59
59
  }
60
60
 
61
- ponyfills.btoa = globalThis.btoa || function btoa(data) {
62
- return Buffer.from(data).toString('base64');
63
- };
61
+ ponyfills.btoa = globalThis.btoa
62
+ if (!ponyfills.btoa) {
63
+ ponyfills.btoa = function btoa(data) {
64
+ return Buffer.from(data).toString('base64');
65
+ };
66
+ }
64
67
 
65
68
  ponyfills.TextEncoder = function TextEncoder(encoding = 'utf-8') {
66
69
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatwg-node/fetch",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Cross Platform Smart Fetch Ponyfill",
5
5
  "author": "Arda TANRIKULU <ardatanrikulu@gmail.com>",
6
6
  "repository": {
@@ -0,0 +1,4 @@
1
+ import { btoa } from '@whatwg-node/fetch';
2
+ it('should work as expected', () => {
3
+ expect(btoa('Hello, world!')).toBe('SGVsbG8sIHdvcmxkIQ==');
4
+ })