Sha256: 550ed5b37392bd96493b0c38212a5bf8779890b7ba964d2ac4049c41e80f774a

Contents?: true

Size: 1.03 KB

Versions: 264

Compression:

Stored size: 1.03 KB

Contents

var root = require('./_root');

/** Detect free variable `exports`. */
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;

/** Detect free variable `module`. */
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;

/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;

/** Built-in value references. */
var Buffer = moduleExports ? root.Buffer : undefined,
    allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;

/**
 * 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.
 */
function cloneBuffer(buffer, isDeep) {
  if (isDeep) {
    return buffer.slice();
  }
  var length = buffer.length,
      result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);

  buffer.copy(result);
  return result;
}

module.exports = cloneBuffer;

Version data entries

264 entries across 262 versions & 29 rubygems

Version Path
appmap-0.71.0 ./node_modules/lodash/_cloneBuffer.js
disco_app-0.16.1 test/dummy/node_modules/lodash/_cloneBuffer.js
appmap-0.70.2 ./node_modules/lodash/_cloneBuffer.js
sumomo-0.8.14 data/sumomo/api_modules/node_modules/lodash/_cloneBuffer.js
appmap-0.70.1 ./node_modules/lodash/_cloneBuffer.js
appmap-0.70.0 ./node_modules/lodash/_cloneBuffer.js
appmap-0.69.0 ./node_modules/lodash/_cloneBuffer.js
sumomo-0.8.13 data/sumomo/api_modules/node_modules/lodash/_cloneBuffer.js
appmap-0.68.2 ./node_modules/lodash/_cloneBuffer.js
appmap-0.68.1 ./node_modules/lodash/_cloneBuffer.js
disco_app-0.15.2 test/dummy/node_modules/lodash/_cloneBuffer.js
appmap-0.68.0 ./node_modules/lodash/_cloneBuffer.js
appmap-0.67.1 ./node_modules/lodash/_cloneBuffer.js
trusty-cms-5.0.3 node_modules/lodash/_cloneBuffer.js
trusty-cms-5.0.2 node_modules/lodash/_cloneBuffer.js
appmap-0.67.0 ./node_modules/lodash/_cloneBuffer.js
disco_app-0.18.4 test/dummy/node_modules/lodash/_cloneBuffer.js
disco_app-0.18.1 test/dummy/node_modules/lodash/_cloneBuffer.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/lodash/_cloneBuffer.js
disco_app-0.14.0 test/dummy/node_modules/lodash/_cloneBuffer.js