import { keys } from 'lodash' ; export interface GetAmountInterface < T = any > { ( base , type , format , obj ) : T extends number ? number : string ; } export default function getAmount < T = string > ( args ) { const { format , type , obj , base } = args ; let v ; keys ( obj ) . map ( ( k ) => { const key = k . toLowerCase ( ) ; const typeOne = `${ format }_${ type }_${ base }` . toLowerCase ( ) ; const typeTwo = `${ type }_${ base }_${ format }` . toLowerCase ( ) ; const typeThree = `${ format }_${ base }_${ type }` . toLowerCase ( ) ; const typeFourth = `${ base }_${ type }_${ format }` . toLowerCase ( ) ; if ( key === typeOne ) { v = obj [ k ] ; } if ( key === typeTwo ) { v = obj [ k ] ; } if ( key === typeThree ) { v = obj [ k ] ; } if ( key === typeFourth ) { v = obj [ k ] ; } } ) ; return v ; }