Skip to content

Commit 2f7d175

Browse files
Make edits per feedback
1 parent 4783ad6 commit 2f7d175

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

extensions/ql-vscode/src/view/RawTableValue.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,31 @@ interface Props {
88
databaseUri: string;
99
}
1010

11+
const codes: { [key: string]: any } = {
12+
'\0': 'U+0000',
13+
'\b': 'U+0008',
14+
'\t': 'U+0009',
15+
'\n': 'U+000A',
16+
'\v': 'U+000B',
17+
'\r': 'U+000D'
18+
};
19+
1120
export default function RawTableValue(props: Props): JSX.Element {
12-
const v = props.value;
13-
const codes: { [key: string]: any } = {
14-
'\n': 'U+000A',
15-
'\b': 'U+2084',
16-
'\0': 'U+0000'
17-
};
21+
const rawValue = props.value;
1822

1923
if (
20-
typeof v === 'string'
21-
|| typeof v === 'number'
22-
|| typeof v === 'boolean'
24+
typeof rawValue === 'string'
25+
|| typeof rawValue === 'number'
26+
|| typeof rawValue === 'boolean'
2327
) {
24-
const text = v.toString();
28+
const text = rawValue.toString();
2529
const newVal = text.split('');
2630
for (let i = 0; i < newVal.length; i++) {
27-
for (const char in codes) {
28-
if (char === newVal[i]) {
29-
newVal[i] = codes[char];
30-
}
31-
}
31+
newVal[i] = codes[newVal[i]] || newVal[i];
3232
}
3333
const cleanVal = newVal.join('');
3434
return <span>{cleanVal}</span>;
3535
}
3636

37-
return renderLocation(v.url, v.label, props.databaseUri);
37+
return renderLocation(rawValue.url, rawValue.label, props.databaseUri);
3838
}

0 commit comments

Comments
 (0)