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
clapton-0.0.12 lib/clapton/javascripts/node_modules/lodash/_cloneBuffer.js
clapton-0.0.11 lib/clapton/javascripts/node_modules/lodash/_cloneBuffer.js
clapton-0.0.10 lib/clapton/javascripts/node_modules/lodash/_cloneBuffer.js
clapton-0.0.9 lib/clapton/javascripts/node_modules/lodash/_cloneBuffer.js
clapton-0.0.8 lib/clapton/javascripts/node_modules/lodash/_cloneBuffer.js
clapton-0.0.7 lib/clapton/javascripts/node_modules/lodash/_cloneBuffer.js
clapton-0.0.6 lib/clapton/javascripts/node_modules/lodash/_cloneBuffer.js
clapton-0.0.5 lib/clapton/javascripts/node_modules/lodash/_cloneBuffer.js
clapton-0.0.4 lib/clapton/javascripts/node_modules/lodash/_cloneBuffer.js
clapton-0.0.3 lib/clapton/javascripts/node_modules/lodash/_cloneBuffer.js
clapton-0.0.2 lib/clapton/javascripts/node_modules/lodash/_cloneBuffer.js
clapton-0.0.1 lib/clapton/javascripts/node_modules/lodash/_cloneBuffer.js
immosquare-cleaner-0.1.47 node_modules/lodash/_cloneBuffer.js
immosquare-cleaner-0.1.46 node_modules/lodash/_cloneBuffer.js
immosquare-cleaner-0.1.45 node_modules/lodash/_cloneBuffer.js
immosquare-cleaner-0.1.44 node_modules/lodash/_cloneBuffer.js
boring_generators-0.14.0 tmp/templates/app_template/node_modules/lodash/_cloneBuffer.js
immosquare-cleaner-0.1.43 node_modules/lodash/_cloneBuffer.js
immosquare-cleaner-0.1.42 node_modules/lodash/_cloneBuffer.js
immosquare-cleaner-0.1.41 node_modules/lodash/_cloneBuffer.js