MCPcopy Create free account
hub / github.com/RubyLouvre/anu / cloneBuffer

Function cloneBuffer

test/babel.js:28194–28203  ·  view source on GitHub ↗

* Creates a clone of `buffer`. * * @private * @param {Buffer} buffer The buffer to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Buffer} Returns the cloned buffer.

(buffer, isDeep)

Source from the content-addressed store, hash-verified

28192 * @returns {Buffer} Returns the cloned buffer.
28193 */
28194 function cloneBuffer(buffer, isDeep) {
28195 if (isDeep) {
28196 return buffer.slice();
28197 }
28198 var length = buffer.length,
28199 result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
28200
28201 buffer.copy(result);
28202 return result;
28203 }
28204
28205 module.exports = cloneBuffer;
28206 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(39)(module)))

Callers 2

baseCloneFunction · 0.85
baseMergeDeepFunction · 0.85

Calls 1

allocUnsafeFunction · 0.85

Tested by

no test coverage detected