@@ -52,7 +52,7 @@ const toPeakStr = (peaks) => {
5252 return str ;
5353} ;
5454
55- let fixedWavelength = null ;
55+ let fixedWavelength = '' ;
5656
5757const extractFixedWavelength = ( source ) => {
5858 const jcamp = Jcampconverter . convert (
@@ -62,8 +62,13 @@ const extractFixedWavelength = (source) => {
6262 keepRecordsRegExp : / ( C S A U T O M E T A D A T A ) / ,
6363 } ,
6464 ) ;
65- // eslint-disable-next-line prefer-destructuring
66- fixedWavelength = jcamp . info . $CSAUTOMETADATA . match ( / F I X E D W A V E L E N G T H = ( [ \d . ] + ) / ) [ 1 ] ;
65+ if ( '$CSAUTOMETADATA' in jcamp . info ) {
66+ const match = jcamp . info . $CSAUTOMETADATA . match ( / F I X E D W A V E L E N G T H = ( [ \d . ] + ) / ) ;
67+ if ( match !== null ) {
68+ // eslint-disable-next-line prefer-destructuring
69+ fixedWavelength = match [ 1 ] ;
70+ }
71+ }
6772
6873 return { fixedWavelength } ;
6974} ;
@@ -86,6 +91,7 @@ const spectraOps = {
8691 [ LIST_LAYOUT . CYCLIC_VOLTAMMETRY ] : { head : 'CYCLIC VOLTAMMETRY' , tail : '.' } ,
8792 [ LIST_LAYOUT . CDS ] : { head : 'CIRCULAR DICHROISM SPECTROSCOPY' , tail : '.' } ,
8893 [ LIST_LAYOUT . SEC ] : { head : 'SIZE EXCLUSION CHROMATOGRAPHY' , tail : '.' } ,
94+ [ LIST_LAYOUT . EMISSIONS ] : { head : 'EMISSION' , tail : ' nm' } ,
8995 [ LIST_LAYOUT . DLS_INTENSITY ] : { head : 'DLS' , tail : '.' } ,
9096} ;
9197
@@ -340,10 +346,10 @@ const peaksWrapper = (layout, shift, atIndex = 0) => {
340346 return { head : '' , tail : '' } ;
341347 }
342348
349+ const ops = spectraOps [ layout ] ;
343350 if ( layout === LIST_LAYOUT . EMISSIONS ) {
344- return { head : `EMISSION : λex = ${ fixedWavelength } nm, λem = ` , tail : ' nm' } ;
351+ return { head : `${ ops . head } ${ solvTxt } : λex = ${ fixedWavelength } nm; λem = ` , tail : ops . tail } ;
345352 }
346- const ops = spectraOps [ layout ] ;
347353 return { head : `${ ops . head } ${ solvTxt } = ` , tail : ops . tail } ;
348354} ;
349355
0 commit comments