aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/util.exports.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/bun.js/util.exports.js')
-rw-r--r--src/bun.js/util.exports.js7
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 || {}))
);
}