diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
commit | bbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch) | |
tree | c58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/iconv-lite/encodings/internal.js | |
parent | 003fb34971cf63466184351b4db5f7c67df4f444 (diff) |
update packages
Diffstat (limited to 'node_modules/iconv-lite/encodings/internal.js')
-rw-r--r-- | node_modules/iconv-lite/encodings/internal.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/node_modules/iconv-lite/encodings/internal.js b/node_modules/iconv-lite/encodings/internal.js index b0adf6a92..05ce38b27 100644 --- a/node_modules/iconv-lite/encodings/internal.js +++ b/node_modules/iconv-lite/encodings/internal.js @@ -1,5 +1,5 @@ "use strict"; -var Buffer = require("buffer").Buffer; +var Buffer = require("safer-buffer").Buffer; // Export Node.js internal encodings. @@ -33,7 +33,7 @@ function InternalCodec(codecOptions, iconv) { this.encoder = InternalEncoderCesu8; // Add decoder for versions of Node not supporting CESU-8 - if (new Buffer('eda0bdedb2a9', 'hex').toString() !== '💩') { + if (Buffer.from('eda0bdedb2a9', 'hex').toString() !== '💩') { this.decoder = InternalDecoderCesu8; this.defaultCharUnicode = iconv.defaultCharUnicode; } @@ -67,7 +67,7 @@ function InternalEncoder(options, codec) { } InternalEncoder.prototype.write = function(str) { - return new Buffer(str, this.enc); + return Buffer.from(str, this.enc); } InternalEncoder.prototype.end = function() { @@ -87,11 +87,11 @@ InternalEncoderBase64.prototype.write = function(str) { this.prevStr = str.slice(completeQuads); str = str.slice(0, completeQuads); - return new Buffer(str, "base64"); + return Buffer.from(str, "base64"); } InternalEncoderBase64.prototype.end = function() { - return new Buffer(this.prevStr, "base64"); + return Buffer.from(this.prevStr, "base64"); } @@ -102,7 +102,7 @@ function InternalEncoderCesu8(options, codec) { } InternalEncoderCesu8.prototype.write = function(str) { - var buf = new Buffer(str.length * 3), bufIdx = 0; + var buf = Buffer.alloc(str.length * 3), bufIdx = 0; for (var i = 0; i < str.length; i++) { var charCode = str.charCodeAt(i); // Naive implementation, but it works because CESU-8 is especially easy |