Files
common/packages/util/src/bn/max.ts
T
Jaco f2d611e26d BN util export (& imports adjust) (#1009)
* BN util export (& imports adjust)

* Fix hexToBn

* Adjusts test

* Move bn export
2021-06-11 11:42:29 +02:00

24 lines
533 B
TypeScript

// Copyright 2017-2021 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { BN } from './bn';
import { checkMaxMin } from './util';
/**
* @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 '@polkadot/util';
*
* bnMax([new BN(1), new BN(3), new BN(2)]).toString(); // => '3'
* ```
*/
export function bnMax (...items: BN[]): BN {
return checkMaxMin('max', items);
}