tolerate da dataview
This commit is contained in:
+4
-1
@@ -10,12 +10,15 @@ export const hexdump = (target, options) => {
|
|||||||
const ansiColor = options.hasOwnProperty("ansiColor") ? options.ansiColor : 0;
|
const ansiColor = options.hasOwnProperty("ansiColor") ? options.ansiColor : 0;
|
||||||
|
|
||||||
let buffer;
|
let buffer;
|
||||||
|
if (target instanceof DataView) {
|
||||||
|
target = target.buffer;
|
||||||
|
}
|
||||||
if (target instanceof ArrayBuffer) {
|
if (target instanceof ArrayBuffer) {
|
||||||
if (length === undefined) length = target.byteLength;
|
if (length === undefined) length = target.byteLength;
|
||||||
else length = Math.min(length, target.byteLength);
|
else length = Math.min(length, target.byteLength);
|
||||||
buffer = target;
|
buffer = target;
|
||||||
} else {
|
} else {
|
||||||
throw "Gimme array buffer";
|
throw "Gimme array buffer or DataView";
|
||||||
}
|
}
|
||||||
|
|
||||||
const startAddress = 0;
|
const startAddress = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user