File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /**
2+ * Returns true if specified value is not undefined, null and empty string
3+ * @param v - value to check
4+ */
5+ export function hasValue < T > ( v : T | undefined | null ) : v is T {
6+ return v !== undefined && v !== null && v !== '' ;
7+ }
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import levenshtein from 'js-levenshtein';
1818import { computeDelta } from './utils/repetitionDiff' ;
1919import TimeMs from '../../../lib/utils/time' ;
2020import { rightTrim } from '../../../lib/utils/string' ;
21+ import { hasValue } from '../../../lib/utils/hasValue' ;
2122
2223/**
2324 * Error code of MongoDB key duplication error
@@ -252,7 +253,7 @@ export default class GrouperWorker extends Worker {
252253 frame . sourceCode = frame . sourceCode . map ( ( line : SourceCodeLine ) => {
253254 return {
254255 line : line . line ,
255- content : line . content !== undefined ? rightTrim ( line . content , MAX_CODE_LINE_LENGTH ) : line . content ,
256+ content : hasValue ( line . content ) ? rightTrim ( line . content , MAX_CODE_LINE_LENGTH ) : line . content ,
256257 } ;
257258 } ) ;
258259 } ) ;
You can’t perform that action at this time.
0 commit comments