diff --git a/CHANGELOG.md b/CHANGELOG.md index 837a3a0f..0e23c0d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ embedding the sources, when using the command-line interface or the legacy JS API. +### JS API + +* `SassNumber.assertUnit()` and `SassNumber.assertNoUnits()` now correctly + return the number called on when it passes the assertion. + ## 1.51.0 * **Potentially breaking change**: Change the order of maps returned by diff --git a/lib/src/node/value/number.dart b/lib/src/node/value/number.dart index e2c33118..fcfcd0ab 100644 --- a/lib/src/node/value/number.dart +++ b/lib/src/node/value/number.dart @@ -38,9 +38,9 @@ final JSClass numberClass = () { 'assertInRange': (SassNumber self, num min, num max, [String? name]) => self.valueInRange(min, max, name), 'assertNoUnits': (SassNumber self, [String? name]) => - self.assertNoUnits(name), + self..assertNoUnits(name), 'assertUnit': (SassNumber self, String unit, [String? name]) => - self.assertUnit(unit, name), + self..assertUnit(unit, name), 'hasUnit': (SassNumber self, String unit) => self.hasUnit(unit), 'compatibleWithUnit': (SassNumber self, String unit) => self.hasUnits && self.compatibleWithUnit(unit),