2016-02-07 23:04:40 -08:00
|
|
|
define(['./_cloneArrayBuffer'], function(cloneArrayBuffer) {
|
2015-12-16 17:53:20 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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) {
|
2016-02-29 23:38:21 -08:00
|
|
|
var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
|
|
|
|
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
2015-12-16 17:53:20 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return cloneTypedArray;
|
|
|
|
|
});
|