export function enumerate < T > ( arr ) { return arr . map ( ( v , i ) => [ i , v ] ) ; } export function divide ( from , split ) { const arr = from . split ( split ) ; return [ arr [ 0 ] , arr . slice ( 1 ) . join ( split ) ] ; } export const dumpBuffer = ( data ) => "0x" + data . toString ( "hex" ) . replace ( /(.)(.)/g , "$1$2 " ) . split ( " " ) . filter ( ( s ) => s != undefined && s . length > 0 ) . join ( ",0x" ) ; export const getObjectSummary = ( obj ) => Object . entries ( { ... obj } ) . reduce ( ( acc , [ key , value ] ) => { if ( typeof value === "number" || typeof value === "string" ) { acc [ key ] = value ; } if ( Buffer . isBuffer ( value ) ) { acc [ key ] = dumpBuffer ( value ) ; } return acc ; } , { } ) ;