UNPKG

mathjs

Version:

Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser and offers an integrated solution to work with numbers, big numbers, complex numbers, units, and matrices.

16 lines (13 loc) 418 B
var DimensionError = require('../../error/DimensionError'); var IndexError = require('../../error/IndexError'); /** * Transform zero-based indices to one-based indices in errors * @param {Error} err * @returns {Error} Returns the transformed error */ exports.transform = function (err) { if (err instanceof IndexError) { return new IndexError(err.index + 1, err.min + 1, err.max + 1); } return err; };