Permalink
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
codeql-action/node_modules/lodash/_cloneBuffer.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

35 lines (28 sloc)
1.03 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |