@hestia-earth/utils 0.13.24 → 0.13.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/number.d.ts CHANGED
@@ -76,3 +76,6 @@ export declare const converters: {
76
76
  export declare const convertValue: (n: number, fromUnit: ConvertUnits, toUnit: ConvertUnits, args?: IConvertArgs) => number;
77
77
  export declare const sum: (values?: number[]) => number;
78
78
  export declare const mean: (values?: number[]) => number;
79
+ export declare const min: (values: number[]) => any;
80
+ export declare const max: (values: number[]) => any;
81
+ export declare const median: (values: number[]) => number;
package/dist/number.js CHANGED
@@ -17,7 +17,7 @@ var __read = (this && this.__read) || function (o, n) {
17
17
  };
18
18
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.mean = exports.sum = exports.convertValue = exports.converters = exports.ConvertUnits = exports.toComma = exports.toPrecision = exports.isNumber = void 0;
20
+ exports.median = exports.max = exports.min = exports.mean = exports.sum = exports.convertValue = exports.converters = exports.ConvertUnits = exports.toComma = exports.toPrecision = exports.isNumber = void 0;
21
21
  /**
22
22
  * Check if the value is a number.
23
23
  *
@@ -198,6 +198,12 @@ var sum = function (values) {
198
198
  exports.sum = sum;
199
199
  var mean = function (values) {
200
200
  if (values === void 0) { values = []; }
201
- return (values === null || values === void 0 ? void 0 : values.length) ? exports.sum(values) / values.length : 0;
201
+ return ((values === null || values === void 0 ? void 0 : values.length) ? exports.sum(values) / values.length : 0);
202
202
  };
203
203
  exports.mean = mean;
204
+ var min = function (values) { return Math.min.apply(Math.min, values); };
205
+ exports.min = min;
206
+ var max = function (values) { return Math.max.apply(Math.max, values); };
207
+ exports.max = max;
208
+ var median = function (values) { return values.sort()[Math.round(values.length / 2)]; };
209
+ exports.median = median;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hestia-earth/utils",
3
- "version": "0.13.24",
3
+ "version": "0.13.26",
4
4
  "description": "HESTIA Utils library",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",