max.transform.js (1351B)
1 "use strict"; 2 3 Object.defineProperty(exports, "__esModule", { 4 value: true 5 }); 6 exports.createMaxTransform = void 0; 7 8 var _factory = require("../../utils/factory.js"); 9 10 var _errorTransform = require("./utils/errorTransform.js"); 11 12 var _max = require("../../function/statistics/max.js"); 13 14 var _lastDimToZeroBase = require("./utils/lastDimToZeroBase.js"); 15 16 var name = 'max'; 17 var dependencies = ['typed', 'config', 'numeric', 'larger']; 18 var createMaxTransform = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) { 19 var typed = _ref.typed, 20 config = _ref.config, 21 numeric = _ref.numeric, 22 larger = _ref.larger; 23 var max = (0, _max.createMax)({ 24 typed: typed, 25 config: config, 26 numeric: numeric, 27 larger: larger 28 }); 29 /** 30 * Attach a transform function to math.max 31 * Adds a property transform containing the transform function. 32 * 33 * This transform changed the last `dim` parameter of function max 34 * from one-based to zero based 35 */ 36 37 return typed('max', { 38 '...any': function any(args) { 39 args = (0, _lastDimToZeroBase.lastDimToZeroBase)(args); 40 41 try { 42 return max.apply(null, args); 43 } catch (err) { 44 throw (0, _errorTransform.errorTransform)(err); 45 } 46 } 47 }); 48 }, { 49 isTransformFunction: true 50 }); 51 exports.createMaxTransform = createMaxTransform;