fix: array should join() without a separator

- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join
This commit is contained in:
curbengh 2019-10-10 08:04:56 +01:00
parent 26b466c1bf
commit 213700a617
No known key found for this signature in database
GPG Key ID: 21EA847C35D6E034
1 changed files with 3 additions and 3 deletions

View File

@ -121,7 +121,7 @@ function minifySvg () {
assetPath.on('end', async () => { assetPath.on('end', async () => {
if (assetTxt.length) { if (assetTxt.length) {
try { try {
const result = await new Svgo(options).optimize(assetTxt.join()) const result = await new Svgo(options).optimize(assetTxt.join(''))
if (options.logger) verbose.call(this, assetTxt.join().toString(), result.data, path, 'svg') if (options.logger) verbose.call(this, assetTxt.join().toString(), result.data, path, 'svg')
resolve(route.set(path, result.data)) resolve(route.set(path, result.data))
} catch (err) { } catch (err) {
@ -156,7 +156,7 @@ function gzipFn () {
if (assetTxt.length) { if (assetTxt.length) {
try { try {
// TODO: Drop Buffer // TODO: Drop Buffer
const input = Buffer.from(assetTxt.join(), 'utf-8') const input = Buffer.from(assetTxt.join(''), 'utf-8')
const result = await gzip(input, { level: zlib.constants.Z_BEST_COMPRESSION }) const result = await gzip(input, { level: zlib.constants.Z_BEST_COMPRESSION })
if (options.logger) verbose.call(this, input, result.toString(), path, 'gzip') if (options.logger) verbose.call(this, input, result.toString(), path, 'gzip')
resolve(route.set(path + '.gz', result)) resolve(route.set(path + '.gz', result))
@ -191,7 +191,7 @@ function brotliFn () {
assetPath.on('end', async () => { assetPath.on('end', async () => {
if (assetTxt.length) { if (assetTxt.length) {
try { try {
const input = Buffer.from(assetTxt.join(), 'utf-8') const input = Buffer.from(assetTxt.join(''), 'utf-8')
const result = await br(input) const result = await br(input)
if (options.logger) verbose.call(this, input, result.toString(), path, 'brotli') if (options.logger) verbose.call(this, input, result.toString(), path, 'brotli')
resolve(route.set(path + '.br', result)) resolve(route.set(path + '.br', result))