mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 14:37:49 +00:00
21 lines
518 B
JavaScript
21 lines
518 B
JavaScript
define(['./_Uint8Array'], function(Uint8Array) {
|
|
|
|
/**
|
|
* Creates a clone of `arrayBuffer`.
|
|
*
|
|
* @private
|
|
* @param {ArrayBuffer} arrayBuffer The array buffer to clone.
|
|
* @returns {ArrayBuffer} Returns the cloned array buffer.
|
|
*/
|
|
function cloneArrayBuffer(arrayBuffer) {
|
|
var Ctor = arrayBuffer.constructor,
|
|
result = new Ctor(arrayBuffer.byteLength),
|
|
view = new Uint8Array(result);
|
|
|
|
view.set(new Uint8Array(arrayBuffer));
|
|
return result;
|
|
}
|
|
|
|
return cloneArrayBuffer;
|
|
});
|