Skip to content

Commit

Permalink
Do not output no units when converting SassNumber to String (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme authored Apr 15, 2022
1 parent 1884872 commit d33bbbd
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/src/value/number.ts
Original file line number Diff line number Diff line change
Expand Up @@ -613,10 +613,16 @@ export class SassNumber extends Value {
}
}

const unitSize = newNumerators.size + newDenominators.size;
return valueError(
`Expected $this to have ${
newNumerators.size + newDenominators.size > 1 ? 'units' : 'unit'
} ${unitString(newNumerators, newDenominators)}.`,
unitSize === 0
? 'no units'
: `unit${unitSize > 1 ? 's' : ''} ${unitString(
newNumerators,
newDenominators
)}`
}.`,
params.name
);
};
Expand Down Expand Up @@ -684,7 +690,7 @@ function unitString(
denominators: List<string>
): string {
if (numerators.isEmpty() && denominators.isEmpty()) {
return 'no units';
return '';
}

if (denominators.isEmpty()) {
Expand Down

0 comments on commit d33bbbd

Please sign in to comment.