Version 1
[yaffs-website] / node_modules / grunt-legacy-log / node_modules / lodash / internal / bufferClone.js
diff --git a/node_modules/grunt-legacy-log/node_modules/lodash/internal/bufferClone.js b/node_modules/grunt-legacy-log/node_modules/lodash/internal/bufferClone.js
new file mode 100644 (file)
index 0000000..f3c12b8
--- /dev/null
@@ -0,0 +1,20 @@
+/** Native method references. */
+var ArrayBuffer = global.ArrayBuffer,
+    Uint8Array = global.Uint8Array;
+
+/**
+ * Creates a clone of the given array buffer.
+ *
+ * @private
+ * @param {ArrayBuffer} buffer The array buffer to clone.
+ * @returns {ArrayBuffer} Returns the cloned array buffer.
+ */
+function bufferClone(buffer) {
+  var result = new ArrayBuffer(buffer.byteLength),
+      view = new Uint8Array(result);
+
+  view.set(new Uint8Array(buffer));
+  return result;
+}
+
+module.exports = bufferClone;