diff --git a/index.js b/index.js index 8987f90..fc06e13 100644 --- a/index.js +++ b/index.js @@ -8,15 +8,13 @@ const imageminSvgo = options => async buffer => { ...options, }; - if (!isSvg(buffer)) { - return buffer; - } + const normalizedInput = Buffer.isBuffer(buffer) ? buffer.toString() : buffer; - if (Buffer.isBuffer(buffer)) { - buffer = buffer.toString(); + if (!isSvg(normalizedInput)) { + return buffer; } - const {data} = optimize(buffer, options); + const {data} = optimize(normalizedInput, options); return Buffer.from(data); }; diff --git a/package.json b/package.json index 4ec6512..36dc190 100644 --- a/package.json +++ b/package.json @@ -28,11 +28,11 @@ "svgo" ], "dependencies": { - "is-svg": "^5.0.0", - "svgo": "^3.2.0" + "is-svg": "^5.0.1", + "svgo": "^3.3.2" }, "devDependencies": { - "ava": "^6.1.2", + "ava": "^6.1.3", "xo": "^0.58.0" } }