Skip to content

Commit

Permalink
Use globalThis for btoa
Browse files Browse the repository at this point in the history
  • Loading branch information
curran committed Jan 26, 2024
1 parent cbb8011 commit 516369d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/SourceMap.js
@@ -1,8 +1,8 @@
import { encode } from '@jridgewell/sourcemap-codec';

function getBtoa() {
if (typeof btoa === 'function') {
return (str) => btoa(unescape(encodeURIComponent(str)));
if (typeof globalThis.btoa === 'function') {

Check failure on line 4 in src/SourceMap.js

View workflow job for this annotation

GitHub Actions / build (14.x, ubuntu-latest)

'globalThis' is not defined

Check failure on line 4 in src/SourceMap.js

View workflow job for this annotation

GitHub Actions / build (14.x, windows-latest)

'globalThis' is not defined

Check failure on line 4 in src/SourceMap.js

View workflow job for this annotation

GitHub Actions / build (14.x, macos-latest)

'globalThis' is not defined
return (str) => globalThis.btoa(unescape(encodeURIComponent(str)));

Check failure on line 5 in src/SourceMap.js

View workflow job for this annotation

GitHub Actions / build (14.x, ubuntu-latest)

'globalThis' is not defined

Check failure on line 5 in src/SourceMap.js

View workflow job for this annotation

GitHub Actions / build (14.x, windows-latest)

'globalThis' is not defined

Check failure on line 5 in src/SourceMap.js

View workflow job for this annotation

GitHub Actions / build (14.x, macos-latest)

'globalThis' is not defined
} else if (typeof Buffer === 'function') {
return (str) => Buffer.from(str, 'utf-8').toString('base64');
} else {
Expand Down

0 comments on commit 516369d

Please sign in to comment.