Skip to content

Commit 254415e

Browse files
authored
fix: check if buffer is available instead of using Buffer module (#45)
1 parent 0ab840c commit 254415e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/deep-map.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const { Buffer } = require('node:buffer')
21
const { serializeError } = require('./error')
32

43
const deepMap = (input, handler = v => v, path = ['$'], seen = new Set([input])) => {
@@ -10,7 +9,7 @@ const deepMap = (input, handler = v => v, path = ['$'], seen = new Set([input]))
109
return deepMap(serializeError(input), handler, path, seen)
1110
}
1211
// allows for non-node js environments, sush as workers
13-
if (input instanceof Buffer) {
12+
if (typeof Buffer !== 'undefined' && input instanceof Buffer) {
1413
return `[unable to log instanceof buffer]`
1514
}
1615
if (input instanceof Uint8Array) {

0 commit comments

Comments
 (0)