Files
common/packages/util/src/bn/max.ts
T
2021-01-03 11:20:22 +01:00

24 lines
530 B
TypeScript

// Copyright 2017-2021 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type BN from 'bn.js';
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);
}