From 3d61e14704bb82ffc1442e6f6c3756f4432b03b4 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 1 Apr 2018 22:03:59 -0700 Subject: [PATCH] buffer: shorten deprecation warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Shorten the deprecation warning for Buffer constructor. PR-URL: https://github.com/nodejs/node/pull/19741 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Trivikram Kamat Reviewed-By: Сковорода Никита Андреевич --- lib/buffer.js | 8 +++----- test/parallel/test-buffer-pending-deprecation.js | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/buffer.js b/lib/buffer.js index 42862c02da98d8..73e3bc44209ee4 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -140,11 +140,9 @@ function alignPool() { } var bufferWarn = true; -const bufferWarning = 'The Buffer() and new Buffer() constructors are not ' + - 'recommended for use due to security and usability ' + - 'concerns. Please use the Buffer.alloc(), ' + - 'Buffer.allocUnsafe(), or Buffer.from() construction ' + - 'methods instead.'; +const bufferWarning = 'Buffer() is deprecated due to security and usability ' + + 'issues. Please use the Buffer.alloc(), ' + + 'Buffer.allocUnsafe(), or Buffer.from() methods instead.'; function showFlaggedDeprecation() { if (bufferWarn) { diff --git a/test/parallel/test-buffer-pending-deprecation.js b/test/parallel/test-buffer-pending-deprecation.js index ba9f1b7bd7b592..1bb7b0bee19f9b 100644 --- a/test/parallel/test-buffer-pending-deprecation.js +++ b/test/parallel/test-buffer-pending-deprecation.js @@ -3,11 +3,9 @@ const common = require('../common'); -const bufferWarning = 'The Buffer() and new Buffer() constructors are not ' + - 'recommended for use due to security and usability ' + - 'concerns. Please use the Buffer.alloc(), ' + - 'Buffer.allocUnsafe(), or Buffer.from() construction ' + - 'methods instead.'; +const bufferWarning = 'Buffer() is deprecated due to security and usability ' + + 'issues. Please use the Buffer.alloc(), ' + + 'Buffer.allocUnsafe(), or Buffer.from() methods instead.'; common.expectWarning('DeprecationWarning', bufferWarning, 'DEP0005');