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
16 lines • 381 B
JavaScript
import { isNumber, isBigNumber } from '../../../utils/is.js';
/**
* Change last argument dim from one-based to zero-based.
*/
export function dimToZeroBase(dim) {
if (isNumber(dim)) {
return dim - 1;
} else if (isBigNumber(dim)) {
return dim.minus(1);
} else {
return dim;
}
}
export function isNumberOrBigNumber(n) {
return isNumber(n) || isBigNumber(n);
}