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
23 lines (22 loc) • 652 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.lastDimToZeroBase = lastDimToZeroBase;
var _is = require("../../../utils/is.js");
var _dimToZeroBase = require("./dimToZeroBase.js");
/**
* Change the last numeric argument (the dim) from one-based to zero-based.
*/
function lastDimToZeroBase(args) {
if (args.length >= 2 && (0, _is.isCollection)(args[0])) {
for (let i = args.length - 1; i >= 1; i--) {
if ((0, _dimToZeroBase.isNumberOrBigNumber)(args[i])) {
args = args.slice();
args[i] = (0, _dimToZeroBase.dimToZeroBase)(args[i]);
break;
}
}
}
return args;
}