Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Revert format changes
  • Loading branch information
jahirfiquitiva authored May 30, 2019
commit a264844a42cd47a3b0231e21225cfc649e2c2886
30 changes: 15 additions & 15 deletions lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@ function alignPool() {
let bufferWarningAlreadyEmitted = false;
let nodeModulesCheckCounter = 0;
const bufferWarning = 'Buffer() is deprecated due to security and usability ' +
'issues. Please use the Buffer.alloc(), ' +
'Buffer.allocUnsafe(), or Buffer.from() methods instead.';
'issues. Please use the Buffer.alloc(), ' +
'Buffer.allocUnsafe(), or Buffer.from() methods instead.';

function showFlaggedDeprecation() {
if (bufferWarningAlreadyEmitted ||
++nodeModulesCheckCounter > 10000 ||
(!require('internal/options').getOptionValue('--pending-deprecation') &&
isInsideNodeModules())) {
++nodeModulesCheckCounter > 10000 ||
(!require('internal/options').getOptionValue('--pending-deprecation') &&
isInsideNodeModules())) {
// We don't emit a warning, because we either:
// - Already did so, or
// - Already checked too many times whether a call is coming
Expand Down Expand Up @@ -211,8 +211,8 @@ Buffer.from = function from(value, encodingOrOffset, length) {

if (typeof value[Symbol.toPrimitive] === 'function') {
return Buffer.from(value[Symbol.toPrimitive]('string'),
encodingOrOffset,
length);
encodingOrOffset,
length);
}
}

Expand Down Expand Up @@ -425,7 +425,7 @@ Buffer.compare = function compare(buf1, buf2) {

Buffer.isEncoding = function isEncoding(encoding) {
return typeof encoding === 'string' && encoding.length !== 0 &&
normalizeEncoding(encoding) !== undefined;
normalizeEncoding(encoding) !== undefined;
};
Buffer[kIsEncodingSymbol] = Buffer.isEncoding;

Expand Down Expand Up @@ -664,10 +664,10 @@ Buffer.prototype[customInspectSymbol] = function inspect(recurseTimes, ctx) {
Buffer.prototype.inspect = Buffer.prototype[customInspectSymbol];

Buffer.prototype.compare = function compare(target,
targetStart,
targetEnd,
sourceStart,
sourceEnd) {
targetStart,
targetEnd,
sourceStart,
sourceEnd) {
if (!isUint8Array(target)) {
throw new ERR_INVALID_ARG_TYPE('target', ['Buffer', 'Uint8Array'], target);
}
Expand Down Expand Up @@ -700,7 +700,7 @@ Buffer.prototype.compare = function compare(target,
return 1;

return compareOffset(this, target, targetStart, sourceStart, targetEnd,
sourceEnd);
sourceEnd);
};

// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
Expand Down Expand Up @@ -867,7 +867,7 @@ Buffer.prototype.write = function write(string, offset, length, encoding) {
length = this.length;
offset = 0;

// Buffer#write(string, offset[, length][, encoding])
// Buffer#write(string, offset[, length][, encoding])
} else {
validateInt32(offset, 'offset', 0, this.length);

Expand Down Expand Up @@ -1026,7 +1026,7 @@ if (internalBinding('config').hasIntl) {
transcode = function transcode(source, fromEncoding, toEncoding) {
if (!isUint8Array(source)) {
throw new ERR_INVALID_ARG_TYPE('source',
['Buffer', 'Uint8Array'], source);
['Buffer', 'Uint8Array'], source);
}
if (source.length === 0) return Buffer.alloc(0);

Expand Down