mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 07:17:50 +00:00
Bump to v4.1.0.
This commit is contained in:
18
_cloneTypedArray.js
Normal file
18
_cloneTypedArray.js
Normal file
@@ -0,0 +1,18 @@
|
||||
var cloneBuffer = require('./_cloneBuffer');
|
||||
|
||||
/**
|
||||
* Creates a clone of `typedArray`.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} typedArray The typed array to clone.
|
||||
* @param {boolean} [isDeep] Specify a deep clone.
|
||||
* @returns {Object} Returns the cloned typed array.
|
||||
*/
|
||||
function cloneTypedArray(typedArray, isDeep) {
|
||||
var buffer = typedArray.buffer,
|
||||
Ctor = typedArray.constructor;
|
||||
|
||||
return new Ctor(isDeep ? cloneBuffer(buffer) : buffer, typedArray.byteOffset, typedArray.length);
|
||||
}
|
||||
|
||||
module.exports = cloneTypedArray;
|
||||
Reference in New Issue
Block a user