mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 08:07:50 +00:00
Bump to v4.1.0.
This commit is contained in:
19
_cloneBuffer.js
Normal file
19
_cloneBuffer.js
Normal file
@@ -0,0 +1,19 @@
|
||||
var Uint8Array = require('./_Uint8Array');
|
||||
|
||||
/**
|
||||
* Creates a clone of `buffer`.
|
||||
*
|
||||
* @private
|
||||
* @param {ArrayBuffer} buffer The array buffer to clone.
|
||||
* @returns {ArrayBuffer} Returns the cloned array buffer.
|
||||
*/
|
||||
function cloneBuffer(buffer) {
|
||||
var Ctor = buffer.constructor,
|
||||
result = new Ctor(buffer.byteLength),
|
||||
view = new Uint8Array(result);
|
||||
|
||||
view.set(new Uint8Array(buffer));
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = cloneBuffer;
|
||||
Reference in New Issue
Block a user