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.

30 lines (23 loc) 718 B
'use strict'; var isBoolean = require('../../util/boolean').isBoolean; var argsToArray = require('../../util/array').argsToArray; /** * Attach a transform function to math.range * Adds a property transform containing the transform function. * * This transform creates a range which includes the end value * @param {Object} math */ module.exports = function (math) { var transform = function () { var args = argsToArray(arguments); var lastIndex = args.length - 1; var last = args[lastIndex]; if (!isBoolean(last)) { args.push(true); // append a parameter includeEnd=true } return math.range.apply(math, args); }; math.range.transform = transform; return transform; };