Files
common/packages/util/src/is/bn.ts
T

25 lines
624 B
TypeScript

// Copyright 2017-2019 @polkadot/util authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import BN from 'bn.js';
/**
* @name isBn
* @summary Tests for a `BN` object instance.
* @description
* Checks to see if the input object is an instance of `BN` (bn.js).
* @example
* <BR>
*
* ```javascript
* import BN from 'bn.js';
* import { isBn } from '@polkadot/util';
*
* console.log('isBn', isBn(new BN(1))); // => true
* ```
*/
export default function isBn (value: any): value is BN {
return BN.isBN(value);
}