import BigNumber from 'bignumber.js' ; export function compareProp < Item , Prop > ( pickFrom ) { return ( a , b ) => { const valA = pickFrom ( a ) ; const valB = pickFrom ( b ) ; return valA === valB ? 0 : valA < valB ? 1 : - 1 ; } ; } export const sortTokensDesc = ( t1 , t2 ) => { const quantity1 = new BigNumber ( t1 . quantity ) ; const quantity2 = new BigNumber ( t2 . quantity ) ; const isLower = quantity2 . lt ( quantity1 ) ; const isGreater = quantity2 . gt ( quantity1 ) ; return isLower ? - 1 : isGreater ? 1 : 0 ; } ;