From ae2ab6740394bc60c0e28fc5eca67b2e663a688a Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Fri, 6 Mar 2020 11:49:35 -0800 Subject: [PATCH] add back support for browsers without SharedArrayBuffer SharedArrayBuffer support originally added in https://github.com/feross/buffer/pull/259 --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 8f8b708..4ec5595 100644 --- a/index.js +++ b/index.js @@ -142,8 +142,9 @@ function from (value, encodingOrOffset, length) { return fromArrayBuffer(value, encodingOrOffset, length) } - if (isInstance(value, SharedArrayBuffer) || - (value && isInstance(value.buffer, SharedArrayBuffer))) { + if (typeof SharedArrayBuffer !== 'undefined' && + (isInstance(value, SharedArrayBuffer) || + (value && isInstance(value.buffer, SharedArrayBuffer)))) { return fromArrayBuffer(value, encodingOrOffset, length) } -- 2.34.1