Skip to content

Commit

Permalink
Use util.inspect instead of .toString(), which doesn't work with node…
Browse files Browse the repository at this point in the history
… 14+

Fixes haithembelhaj#23
  • Loading branch information
stfp committed Mar 31, 2021
1 parent c6b9d34 commit 9f3a530
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const serialize = require('dom-serializer');
const svgToDataUri = require('mini-svg-data-uri');
const svgo = new (require('svgo'))();
const optimize = deasync(optimizeAsync);
const util = require('util');

const defaultOptions = { optimize: false, encodingFormat: 'base64' };

Expand Down Expand Up @@ -96,11 +97,11 @@ function mapToObj(map) {
const key = map.getKey(i).getValue();
let value = map.getValue(i);

switch (value.toString()) {
case '[object SassMap]':
switch (util.inspect(value)) {
case 'SassMap {}':
value = mapToObj(value);
break;
case '[object SassColor]':
case 'SassColor {}':
if (value.getA() === 1) {
value = 'rgb(' + value.getR() + ',' + value.getG() + ',' + value.getB() + ')';
} else {
Expand Down

0 comments on commit 9f3a530

Please sign in to comment.