mirror of
https://github.com/josdejong/mathjs.git
synced 2025-12-08 19:46:04 +00:00
26 lines
675 B
JavaScript
26 lines
675 B
JavaScript
'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) {
|
|
math.range.__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);
|
|
};
|
|
};
|