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

Function concatenateArrayBuffers

docs/app/js/sanddance-app.js:53880–53903  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

53878 return true;
53879}
53880function concatenateArrayBuffers() {
53881 for(var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++)sources[_key] = arguments[_key];
53882 var sourceArrays = sources.map(function(source2) {
53883 return source2 instanceof ArrayBuffer ? new Uint8Array(source2) : source2;
53884 });
53885 var byteLength = sourceArrays.reduce(function(length, typedArray) {
53886 return length + typedArray.byteLength;
53887 }, 0);
53888 var result = new Uint8Array(byteLength);
53889 var offset = 0;
53890 var _iterator = _createForOfIteratorHelper(sourceArrays), _step;
53891 try {
53892 for(_iterator.s(); !(_step = _iterator.n()).done;){
53893 var sourceArray = _step.value;
53894 result.set(sourceArray, offset);
53895 offset += sourceArray.byteLength;
53896 }
53897 } catch (err) {
53898 _iterator.e(err);
53899 } finally{
53900 _iterator.f();
53901 }
53902 return result.buffer;
53903}
53904function sliceArrayBuffer(arrayBuffer, byteOffset, byteLength) {
53905 var subArray = byteLength !== undefined ? new Uint8Array(arrayBuffer).subarray(byteOffset, byteOffset + byteLength) : new Uint8Array(arrayBuffer).subarray(byteOffset);
53906 var arrayCopy = new Uint8Array(subArray);

Callers

nothing calls this directly

Calls 2

setMethod · 0.45

Tested by

no test coverage detected