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)