diff options
author | 2023-02-08 17:18:02 -0800 | |
---|---|---|
committer | 2023-02-08 17:18:02 -0800 | |
commit | ddec9e0bf639ae2f672c71c228759f741f805735 (patch) | |
tree | b07007dfd5716525761f08394e3092ee70efac34 /src/bun.js/util.exports.js | |
parent | 4962bea4fc269e537a8f505e2484d1bb289b8d9f (diff) | |
download | bun-ddec9e0bf639ae2f672c71c228759f741f805735.tar.gz bun-ddec9e0bf639ae2f672c71c228759f741f805735.tar.zst bun-ddec9e0bf639ae2f672c71c228759f741f805735.zip |
handle more cases with util.isErrorbun-v0.5.6
Diffstat (limited to 'src/bun.js/util.exports.js')
-rw-r--r-- | src/bun.js/util.exports.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/bun.js/util.exports.js b/src/bun.js/util.exports.js index c0adc0344..ce618784d 100644 --- a/src/bun.js/util.exports.js +++ b/src/bun.js/util.exports.js @@ -3,11 +3,16 @@ var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; + +function isBufferInterface({ copy, fill, readUint8 }) { + return typeof copy === "function" && typeof fill === "function" && typeof readUint8 === "function"; +} + export function isBuffer(value) { return ( Buffer.isBuffer(value) || // incase it ends up as a browserify buffer - (typeof arg?.copy === "function" && typeof arg?.fill === "function" && typeof arg?.readUInt8 === "function") + (typeof value === "object" && isBufferInterface(value || {})) ); } |