From 205d73cfc5b87b9b2513fb3aa985a0c6a5f0b863 Mon Sep 17 00:00:00 2001 From: rambo Date: Wed, 17 Aug 2022 16:14:24 +0800 Subject: [PATCH 1/3] feat: add Buffer JSON.stringify obj --- load-image.js | 1 + 1 file changed, 1 insertion(+) diff --git a/load-image.js b/load-image.js index 3df8d6cf..44b77980 100644 --- a/load-image.js +++ b/load-image.js @@ -86,6 +86,7 @@ function createImage(src, alt) { function isBufferLike(src) { return ( + src?.type === "Buffer" || Array.isArray(src) || src instanceof ArrayBuffer || src instanceof SharedArrayBuffer || From d4e6e12952f38f77e6ca40af05df54d2e9dabba9 Mon Sep 17 00:00:00 2001 From: rambo Date: Wed, 17 Aug 2022 16:15:43 +0800 Subject: [PATCH 2/3] fix: compatible with old syntax --- load-image.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/load-image.js b/load-image.js index 44b77980..d49c2544 100644 --- a/load-image.js +++ b/load-image.js @@ -86,7 +86,7 @@ function createImage(src, alt) { function isBufferLike(src) { return ( - src?.type === "Buffer" || + (src && src.type === "Buffer") || Array.isArray(src) || src instanceof ArrayBuffer || src instanceof SharedArrayBuffer || From 3d339f75753bf3168fb49126e6801a4667c56f86 Mon Sep 17 00:00:00 2001 From: rambo Date: Wed, 17 Aug 2022 16:37:19 +0800 Subject: [PATCH 3/3] fix: prettier --- load-image.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/load-image.js b/load-image.js index d49c2544..35c80556 100644 --- a/load-image.js +++ b/load-image.js @@ -86,7 +86,7 @@ function createImage(src, alt) { function isBufferLike(src) { return ( - (src && src.type === "Buffer") || + (src && src.type === 'Buffer') || Array.isArray(src) || src instanceof ArrayBuffer || src instanceof SharedArrayBuffer ||