mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 16:47:49 +00:00
Bump to v4.0.0.
This commit is contained in:
19
internal/cloneTypedArray.js
Normal file
19
internal/cloneTypedArray.js
Normal file
@@ -0,0 +1,19 @@
|
||||
define(['./cloneBuffer'], function(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);
|
||||
}
|
||||
|
||||
return cloneTypedArray;
|
||||
});
|
||||
Reference in New Issue
Block a user