mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
23 lines
522 B
JavaScript
23 lines
522 B
JavaScript
import root from './root';
|
|
|
|
/** Native method references. */
|
|
var ArrayBuffer = root.ArrayBuffer,
|
|
Uint8Array = root.Uint8Array;
|
|
|
|
/**
|
|
* Creates a clone of the given array buffer.
|
|
*
|
|
* @private
|
|
* @param {ArrayBuffer} buffer The array buffer to clone.
|
|
* @returns {ArrayBuffer} Returns the cloned array buffer.
|
|
*/
|
|
function bufferClone(buffer) {
|
|
var result = new ArrayBuffer(buffer.byteLength),
|
|
view = new Uint8Array(result);
|
|
|
|
view.set(new Uint8Array(buffer));
|
|
return result;
|
|
}
|
|
|
|
export default bufferClone;
|