Skip to content

Commit

Permalink
[WIP] buffer: pending-deprecate SlowBuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
ChALkeR committed Jan 31, 2018
1 parent a122b74 commit f12cdb5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ instead.
<a id="DEP0030"></a>
### DEP0030: SlowBuffer

Type: Documentation-only
Type: Documentation-only (supports [`--pending-deprecation`][])

The [`SlowBuffer`][] class has been deprecated. Please use
[`Buffer.allocUnsafeSlow(size)`][] instead.
Expand Down
5 changes: 5 additions & 0 deletions lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ const bufferWarning = 'The Buffer() and new Buffer() constructors are not ' +
'methods instead.';
const deprecation0005 = deprecator(bufferWarning, 'DEP0005', { pending: true });

const slowWarning = 'The SlowBuffer() class has been deprecated. Please use ' +
'Buffer.allocUnsafeSlow(size) instead.';
const deprecation0030 = deprecator(slowWarning, 'DEP0030', { pending: true });

/**
* The Buffer() constructor is deprecated in documentation and should not be
* used moving forward. Rather, developers should use one of the three new
Expand Down Expand Up @@ -275,6 +279,7 @@ Buffer.allocUnsafeSlow = function allocUnsafeSlow(size) {
// If --zero-fill-buffers command line argument is set, a zero-filled
// buffer is returned.
function SlowBuffer(length) {
deprecation0030(SlowBuffer);
// eslint-disable-next-line eqeqeq
if (+length != length)
length = 0;
Expand Down

0 comments on commit f12cdb5

Please sign in to comment.