From a6f08ec26e19a4e9062f7ff8326a103a2d23cf2d Mon Sep 17 00:00:00 2001 From: ayman Date: Mon, 17 Jun 2024 09:08:24 +0530 Subject: [PATCH] fix: standardjs error for empty if block --- src/cjs/index.cjs | 3 ++- src/esm/index.js | 3 ++- ts_src/index.ts | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/cjs/index.cjs b/src/cjs/index.cjs index 9f15cc0..0124347 100644 --- a/src/cjs/index.cjs +++ b/src/cjs/index.cjs @@ -22,7 +22,8 @@ function base (ALPHABET) { const FACTOR = Math.log(BASE) / Math.log(256) // log(BASE) / log(256), rounded up const iFACTOR = Math.log(256) / Math.log(BASE) // log(256) / log(BASE), rounded up function encode (source) { - if (ArrayBuffer.isView(source)) { + // eslint-disable-next-line no-empty + if (source instanceof Uint8Array) { } else if (ArrayBuffer.isView(source)) { source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength) } else if (Array.isArray(source)) { source = Uint8Array.from(source) diff --git a/src/esm/index.js b/src/esm/index.js index f09bfbe..ac60db8 100644 --- a/src/esm/index.js +++ b/src/esm/index.js @@ -20,7 +20,8 @@ function base (ALPHABET) { const FACTOR = Math.log(BASE) / Math.log(256) // log(BASE) / log(256), rounded up const iFACTOR = Math.log(256) / Math.log(BASE) // log(256) / log(BASE), rounded up function encode (source) { - if (ArrayBuffer.isView(source)) { + // eslint-disable-next-line no-empty + if (source instanceof Uint8Array) { } else if (ArrayBuffer.isView(source)) { source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength) } else if (Array.isArray(source)) { source = Uint8Array.from(source) diff --git a/ts_src/index.ts b/ts_src/index.ts index dd1251b..66e0e4b 100644 --- a/ts_src/index.ts +++ b/ts_src/index.ts @@ -26,7 +26,9 @@ function base (ALPHABET: string): base.BaseConverter { const iFACTOR = Math.log(256) / Math.log(BASE) // log(256) / log(BASE), rounded up function encode (source: Uint8Array | number[]): string { - if (ArrayBuffer.isView(source)) { + //eslint-disable-next-line no-empty + if (source instanceof Uint8Array) {} + else if (ArrayBuffer.isView(source)) { source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength) } else if (Array.isArray(source)) { source = Uint8Array.from(source)