From 2b3f9de403dd4af8230ac9845bdaae9d6e33760d Mon Sep 17 00:00:00 2001 From: Hans Date: Thu, 15 Nov 2018 11:49:20 -0800 Subject: [PATCH] refactor: use Buffer.from instead of deprecated constructor --- lib/istanbul-local.js | 2 +- scripts/changelog.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/istanbul-local.js b/lib/istanbul-local.js index ef5782661a..f1bdb1ebfe 100644 --- a/lib/istanbul-local.js +++ b/lib/istanbul-local.js @@ -46,7 +46,7 @@ exports.istanbulRequireHook = function(code, filename) { instrumentedCode = instrumentedCode.replace(inlineSourceMapRe, '') + '//# sourceMappingURL=data:application/json;base64,' - + new Buffer(sourceMapGenerator.toString()).toString('base64'); + + Buffer.from(sourceMapGenerator.toString()).toString('base64'); // Keep the consumer from the original source map, because the reports from Istanbul (not // Constantinople) are already mapped against the code. diff --git a/scripts/changelog.ts b/scripts/changelog.ts index 88e8c8030b..303111db38 100644 --- a/scripts/changelog.ts +++ b/scripts/changelog.ts @@ -55,7 +55,7 @@ export default function(args: ChangelogOptions, logger: logging.Logger) { const commit = chunk.toString('utf-8') .replace(/https?:\/\/github.com\/(.*?)\/issues\/(\d+)/g, '@$1#$2'); - callback(undefined, new Buffer(commit)); + callback(undefined, Buffer.from(commit)); })) .pipe(conventionalCommitsParser({ headerPattern: /^(\w*)(?:\(([^)]*)\))?: (.*)$/,