Skip to content

Commit

Permalink
Revert "buffer: runtime deprecation of calling Buffer without new"
Browse files Browse the repository at this point in the history
This reverts commit f2fe558
(#8169) as the original
justification for the runtime-deprecation does not appear
to justify the disruption to Node’s existing ecosystem.
Futhermore, the possibility of deprecating the Buffer constructor
entirely in v8.0 might lead to people having to change their code twice.
  • Loading branch information
addaleax committed Nov 9, 2016
1 parent 305f75a commit 755ebdf
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 21 deletions.
10 changes: 0 additions & 10 deletions lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,7 @@ function alignPool() {
* much breakage at this time. It's not likely that the Buffer constructors
* would ever actually be removed.
**/
var newBufferWarned = false;
function Buffer(arg, encodingOrOffset, length) {
if (!new.target && !newBufferWarned) {
newBufferWarned = true;
process.emitWarning(
'Using Buffer without `new` will soon stop working. ' +
'Use `new Buffer()`, or preferably ' +
'`Buffer.from()`, `Buffer.allocUnsafe()` or `Buffer.alloc()` instead.',
'DeprecationWarning'
);
}
// Common case.
if (typeof arg === 'number') {
if (typeof encodingOrOffset === 'string') {
Expand Down
11 changes: 0 additions & 11 deletions test/parallel/test-buffer-deprecated.js

This file was deleted.

0 comments on commit 755ebdf

Please sign in to comment.