You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(units)!: prefer input-family unit for non-integer scaled values
BREAKING CHANGE: `scaleBy` and `scaleTo` now emit `FractionValue`
instead of `DecimalValue` for scaled quantities whose result can be
expressed as an allowed fraction on a fraction-enabled unit (e.g. 0.5
on `cup` → `{type:"fraction", num:1, den:2}`). This affects units that
have `fractions.enabled` set (cup, lb, oz, tsp, tbsp, fl-oz, etc.).
Units without fraction support (g, ml, kg, l, piece, …) are unaffected.
Callers that branch on `value.type` or access `value.decimal` directly
for these units must handle `FractionValue` alongside `DecimalValue`.
it("should prefer the smallest integer of all integers in any family over non-integers in input family",()=>{
62
-
// 236.6 ml = ~1 cup or ~8 fl-oz
61
+
it("should prefer the smallest integer of all integers in any family over non-integers in input family (when input family unit has no fractions)",()=>{
62
+
// 236.6 ml in US system: mL is metric (not US-compatible), so excluded from candidates.
63
+
// cup ≈ 1 (integer, any family) wins. This is the system-conversion case.
0 commit comments