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
17 lines (16 loc) • 426 B
JavaScript
import { isBigNumber, isCollection, isNumber } from '../../../utils/is.js';
/**
* Change last argument dim from one-based to zero-based.
*/
export function lastDimToZeroBase(args) {
if (args.length === 2 && isCollection(args[0])) {
args = args.slice();
var dim = args[1];
if (isNumber(dim)) {
args[1] = dim - 1;
} else if (isBigNumber(dim)) {
args[1] = dim.minus(1);
}
}
return args;
}