std.transform.js (983B)
1 import { factory } from '../../utils/factory.js'; 2 import { createStd } from '../../function/statistics/std.js'; 3 import { errorTransform } from './utils/errorTransform.js'; 4 import { lastDimToZeroBase } from './utils/lastDimToZeroBase.js'; 5 var name = 'std'; 6 var dependencies = ['typed', 'sqrt', 'variance']; 7 /** 8 * Attach a transform function to math.std 9 * Adds a property transform containing the transform function. 10 * 11 * This transform changed the `dim` parameter of function std 12 * from one-based to zero based 13 */ 14 15 export var createStdTransform = /* #__PURE__ */factory(name, dependencies, _ref => { 16 var { 17 typed, 18 sqrt, 19 variance 20 } = _ref; 21 var std = createStd({ 22 typed, 23 sqrt, 24 variance 25 }); 26 return typed('std', { 27 '...any': function any(args) { 28 args = lastDimToZeroBase(args); 29 30 try { 31 return std.apply(null, args); 32 } catch (err) { 33 throw errorTransform(err); 34 } 35 } 36 }); 37 }, { 38 isTransformFunction: true 39 });