import { TgElementExtraData } from '../type' ; export function get ( value ? , data ? ) { const items = { } ; if ( typeof value === 'string' && value . trim ( ) !== '' ) { value . split ( ';' ) . forEach ( ( pair ) => { let arr = pair . split ( ':' ) ; if ( arr . length === 2 ) { if ( arr [ 0 ] . indexOf ( ',' ) > - 1 ) { arr [ 0 ] . split ( ',' ) . forEach ( ( key ) => { items [ key . trim ( ) ] = arr [ 1 ] . trim ( ) ; } ) ; } else if ( arr [ 0 ] . indexOf ( '...' ) > - 1 ) { let [ from , to ] = arr [ 0 ] . split ( '...' ) . map ( ( val ) => { return + val ; } ) . sort ( ( a , b ) => a - b ) ; let i = from ; while ( i <= to ) { i = Number ( i . toFixed ( data ?. decimals || 2 ) ) ; items [ i ] = arr [ 1 ] . trim ( ) ; i += data ?. increment || 0.01 ; } } else { items [ arr [ 0 ] . trim ( ) ] = arr [ 1 ] . trim ( ) ; } } } ) ; } return items ; }