diff --git a/lib/coa.js b/lib/coa.js index 952ee862..4fb88c7a 100644 --- a/lib/coa.js +++ b/lib/coa.js @@ -179,7 +179,7 @@ function printPhantomTestInfo(file1, file2, width, height) { if (code === 1) { answer = 'OK'; } else if (code === 2) { - answer = 'Oops, files are not visually identical!\n\nIf you do not see any visual differences with your eyes then \ALL IS OK and there are only very minor floating point numbers rounding errors in some browsers.\nBut if you see significant errors then things are bad :), please create an issue at https://github.com/svg/svgo/issues'; + answer = 'Oops, files are not visually identical!\n\nIf you do not see any visual differences with your eyes then ALL IS OK and there are only very minor floating point numbers rounding errors in some browsers.\nBut if you see significant errors then things are bad :), please create an issue at https://github.com/svg/svgo/issues'; } else if (code === 3) { answer = 'Error while rendering SVG\nPlease create an issue at https://github.com/svg/svgo/issues'; } else if (code === 127) { diff --git a/plugins/cleanupEnableBackground.js b/plugins/cleanupEnableBackground.js index 85e130d4..63d32986 100644 --- a/plugins/cleanupEnableBackground.js +++ b/plugins/cleanupEnableBackground.js @@ -26,12 +26,12 @@ exports.cleanupEnableBackground = function(item, params) { item.hasAttr('height') ) { - var match; + var match = item.attr('enable-background').value.match(regEnableBackground); - if (match = item.attr('enable-background').value.match(regEnableBackground)) { + if (match) { if ( - item.attr('width').value == match[1] && - item.attr('height').value == match[2] + item.attr('width').value === match[1] && + item.attr('height').value === match[2] ) { if (item.isElem('svg')) { item.removeAttr('enable-background'); diff --git a/plugins/cleanupSVGElem.js b/plugins/cleanupSVGElem.js index 69b6cdf5..4f39cef2 100644 --- a/plugins/cleanupSVGElem.js +++ b/plugins/cleanupSVGElem.js @@ -1,5 +1,3 @@ -var regViewBox = /^0\s0\s(\d+)\s(\d+)$/; - /** * Remove some useless svg element attributes. * diff --git a/plugins/convertColors.js b/plugins/convertColors.js index bf3c2f6c..2b024e07 100644 --- a/plugins/convertColors.js +++ b/plugins/convertColors.js @@ -16,8 +16,8 @@ var collections = require('./_collections'), * @author Jed Schmidt */ function rgb2hex(rgb) { - return "#" + ((256 + rgb[0] << 8 | rgb[1]) << 8 | rgb[2]).toString(16).slice(1); -}; + return '#' + ((256 + rgb[0] << 8 | rgb[1]) << 8 | rgb[2]).toString(16).slice(1); +} /** * Convert different colors formats in element attributes to hex. diff --git a/plugins/removeDefaultPx.js b/plugins/removeDefaultPx.js index ebff2cdc..7c92a44e 100644 --- a/plugins/removeDefaultPx.js +++ b/plugins/removeDefaultPx.js @@ -18,7 +18,7 @@ exports.removeDefaultPx = function(item, params) { if (item.isElem() && item.hasAttr()) { item.eachAttr(function(attr) { - attr.value = attr.value.replace(regValPx, "$1"); + attr.value = attr.value.replace(regValPx, '$1'); }); } diff --git a/plugins/removeViewBox.js b/plugins/removeViewBox.js index 49540aa2..dc5dd6cc 100644 --- a/plugins/removeViewBox.js +++ b/plugins/removeViewBox.js @@ -26,12 +26,12 @@ exports.removeViewBox = function(item, params) { item.hasAttr('height') ) { - var match; + var match = item.attr('viewBox').value.match(regViewBox); - if (match = item.attr('viewBox').value.match(regViewBox)) { + if (match) { if ( - item.attr('width').value == match[1] && - item.attr('height').value == match[2] + item.attr('width').value === match[1] && + item.attr('height').value === match[2] ) { item.removeAttr('viewBox'); }