All Downloads are FREE. Search and download functionalities are using the official Maven repository.

node_modules.bower.lib.node_modules.lodash.internal.cloneTypedArray.js Maven / Gradle / Ivy

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;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy