MCPcopy Create free account
hub / github.com/microsoft/SandDance / toArrayBuffer

Function toArrayBuffer

docs/app/js/sanddance-app.js:53858–53869  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

53856 return arr2;
53857}
53858function toArrayBuffer(data) {
53859 if (_bufferUtilsNode.toArrayBuffer) data = _bufferUtilsNode.toArrayBuffer(data);
53860 if (data instanceof ArrayBuffer) return data;
53861 if (ArrayBuffer.isView(data)) return data.buffer;
53862 if (typeof data === "string") {
53863 var text = data;
53864 var uint8Array = new TextEncoder().encode(text);
53865 return uint8Array.buffer;
53866 }
53867 if (data && (0, _typeofDefault.default)(data) === "object" && data._toArrayBuffer) return data._toArrayBuffer();
53868 return (0, _assertDefault.default)(false);
53869}
53870function compareArrayBuffers(arrayBuffer1, arrayBuffer2, byteLength) {
53871 byteLength = byteLength || arrayBuffer1.byteLength;
53872 if (arrayBuffer1.byteLength < byteLength || arrayBuffer2.byteLength < byteLength) return false;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected