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

17 lines • 514 B
import { isCollection } from '../../../utils/is.js'; import { dimToZeroBase, isNumberOrBigNumber } from './dimToZeroBase.js'; /** * Change the last numeric argument (the dim) from one-based to zero-based. */ export function lastDimToZeroBase(args) { if (args.length >= 2 && isCollection(args[0])) { for (var i = args.length - 1; i >= 1; i--) { if (isNumberOrBigNumber(args[i])) { args = args.slice(); args[i] = dimToZeroBase(args[i]); break; } } } return args; }