mirror of
https://github.com/pezkuwichain/pezkuwi-common.git
synced 2026-04-25 18:47:58 +00:00
33 lines
848 B
JavaScript
33 lines
848 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.bnMin = exports.bnMax = void 0;
|
|
const helpers_js_1 = require("../bi/helpers.js");
|
|
/**
|
|
* @name bnMax
|
|
* @summary Finds and returns the highest value in an array of BNs.
|
|
* @example
|
|
* <BR>
|
|
*
|
|
* ```javascript
|
|
* import BN from 'bn.js';
|
|
* import { bnMax } from '@pezkuwi/util';
|
|
*
|
|
* bnMax([new BN(1), new BN(3), new BN(2)]).toString(); // => '3'
|
|
* ```
|
|
*/
|
|
exports.bnMax = (0, helpers_js_1.createCmp)((a, b) => a.gt(b));
|
|
/**
|
|
* @name bnMin
|
|
* @summary Finds and returns the smallest value in an array of BNs.
|
|
* @example
|
|
* <BR>
|
|
*
|
|
* ```javascript
|
|
* import BN from 'bn.js';
|
|
* import { bnMin } from '@pezkuwi/util';
|
|
*
|
|
* bnMin([new BN(1), new BN(3), new BN(2)]).toString(); // => '1'
|
|
* ```
|
|
*/
|
|
exports.bnMin = (0, helpers_js_1.createCmp)((a, b) => a.lt(b));
|