Does it make sense to move this to `utils/rational-expressions.js`?