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.

PR-URL: #9529
Reviewed-By: Roman Reiss <[email protected]>
Reviewed-By: Myles Borins <[email protected]>
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: Nikolai Vavilov <[email protected]>
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
addaleax committed Dec 5, 2016
1 parent d06f010 commit e0e62d1
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 e0e62d1

Please sign in to comment.