1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.bnMin = exports.bnMax = void 0;
|
4 | const helpers_js_1 = require("../bi/helpers.js");
|
5 | /**
|
6 | * @name bnMax
|
7 | * @summary Finds and returns the highest value in an array of BNs.
|
8 | * @example
|
9 | * <BR>
|
10 | *
|
11 | * ```javascript
|
12 | * import BN from 'bn.js';
|
13 | * import { bnMax } from '@polkadot/util';
|
14 | *
|
15 | * bnMax([new BN(1), new BN(3), new BN(2)]).toString(); // => '3'
|
16 | * ```
|
17 | */
|
18 | exports.bnMax = (0, helpers_js_1.createCmp)((a, b) => a.gt(b));
|
19 | /**
|
20 | * @name bnMin
|
21 | * @summary Finds and returns the smallest value in an array of BNs.
|
22 | * @example
|
23 | * <BR>
|
24 | *
|
25 | * ```javascript
|
26 | * import BN from 'bn.js';
|
27 | * import { bnMin } from '@polkadot/util';
|
28 | *
|
29 | * bnMin([new BN(1), new BN(3), new BN(2)]).toString(); // => '1'
|
30 | * ```
|
31 | */
|
32 | exports.bnMin = (0, helpers_js_1.createCmp)((a, b) => a.lt(b));
|