Skip to content

Commit

Permalink
fix: Buffer not using global in browser (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie committed Feb 23, 2021
1 parent f8a36bf commit 21584fc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/bn.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@

var Buffer;
try {
Buffer = require('buffer').Buffer;
if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') {
Buffer = window.Buffer;
} else {
Buffer = require('buffer').Buffer;
}
} catch (e) {
}

Expand Down

0 comments on commit 21584fc

Please sign in to comment.