PNG
IHDR ; IDATxܻn0K
)(pA7LeG{ §㻢|ذaÆ
6lذaÆ
6lذaÆ
6lom$^yذag5 bÆ
6lذaÆ
6lذa{
6lذaÆ
`}HFkm,mӪôô!x|'ܢ˟;E:9&ᶒ}{v]n&6
h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%tMז -lG6mrz2s%9s@-k9=)kB5\+͂ZsٲRn~GRCwIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL /F*\Ԕ#"5m2[S=gnaPeғL
lذaÆ
6l^ḵaÆ
6lذaÆ
6lذa;
_ذaÆ
6lذaÆ
6lذaÆ
R IENDB`
'use strict';
exports.name = 'removeDimensions';
exports.type = 'perItem';
exports.active = false;
exports.description =
'removes width and height in presence of viewBox (opposite to removeViewBox, disable it first)';
/**
* Remove width/height attributes and add the viewBox attribute if it's missing
*
* @example
*
* ↓
*
*
* @param {Object} item current iteration item
* @return {Boolean} if true, with and height will be filtered out
*
* @author Benny Schudel
*/
exports.fn = function (item) {
if (item.type === 'element' && item.name === 'svg') {
if (item.attributes.viewBox != null) {
delete item.attributes.width;
delete item.attributes.height;
} else if (
item.attributes.width != null &&
item.attributes.height != null &&
Number.isNaN(Number(item.attributes.width)) === false &&
Number.isNaN(Number(item.attributes.height)) === false
) {
const width = Number(item.attributes.width);
const height = Number(item.attributes.height);
item.attributes.viewBox = `0 0 ${width} ${height}`;
delete item.attributes.width;
delete item.attributes.height;
}
}
};