From b9c260d8a3f2a4e916748de028080f47a2a27649 Mon Sep 17 00:00:00 2001 From: Torben Neufeldt Date: Thu, 29 Sep 2022 09:42:14 +0200 Subject: [PATCH] Remove encode-utf8 --- lib/core/byte-data.js | 6 +++--- package-lock.json | 5 ----- package.json | 1 - 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/core/byte-data.js b/lib/core/byte-data.js index 289a601..d562fcc 100644 --- a/lib/core/byte-data.js +++ b/lib/core/byte-data.js @@ -1,12 +1,12 @@ -const encodeUtf8 = require('encode-utf8') const Mode = require('./mode') function ByteData (data) { this.mode = Mode.BYTE if (typeof (data) === 'string') { - data = encodeUtf8(data) + this.data = new TextEncoder().encode(data) + } else { + this.data = new Uint8Array(data) } - this.data = new Uint8Array(data) } ByteData.getBitsLength = function getBitsLength (length) { diff --git a/package-lock.json b/package-lock.json index 7215732..895757e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2529,11 +2529,6 @@ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" }, - "encode-utf8": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/encode-utf8/-/encode-utf8-1.0.3.tgz", - "integrity": "sha512-ucAnuBEhUK4boH2HjVYG5Q2mQyPorvv0u/ocS+zhdw0S8AlHYY+GOFhP1Gio5z4icpP2ivFSvhtFjQi8+T9ppw==" - }, "encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", diff --git a/package.json b/package.json index 03f589a..276817c 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ }, "dependencies": { "dijkstrajs": "^1.0.1", - "encode-utf8": "^1.0.3", "pngjs": "^5.0.0", "yargs": "^15.3.1" },