import { ethers } from 'ethers' ; import { BigNumber } from 'bignumber.js' ; export function isInstanceOfBigNumber ( object ) { return isObject ( object ) && object instanceof BigNumber ; } export function isInstanceOfEthersBigNumber ( object ) { return isObject ( object ) && object instanceof ethers . utils . BigNumber ; } export function isInstanceOfArray ( object ) { return isObject ( object ) && object instanceof Array ; } export function isObject ( val ) { if ( val === null ) { return false ; } return ( ( typeof val === 'function' ) || ( typeof val === 'object' ) ) ; } export class Counter extends Map { increment ( key ) { this . set ( key , ( this . get ( key ) || 0 ) + 1 ) ; } decrement ( key ) { this . set ( key , ( this . get ( key ) || 0 ) - 1 ) ; } toTabularData ( ) { const output = [ ] ; for ( const [ method , count ] of this ) { output . push ( { method , count , } ) ; } return output ; } }