UNPKG

mathjs

Version:

Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with dif

14 lines 441 B
import { factory } from '../../utils/factory.js'; export var createCompareUnits = /* #__PURE__ */factory('compareUnits', ['typed'], _ref => { var { typed } = _ref; return { 'Unit, Unit': typed.referToSelf(self => (x, y) => { if (!x.equalBase(y)) { throw new Error('Cannot compare units with different base'); } return typed.find(self, [x.valueType(), y.valueType()])(x.value, y.value); }) }; });