-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(website): improve review page by removing null values (#2000)
* improve review page by removing null values * Automated code formatting --------- Co-authored-by: Loculus bot <[email protected]>
- Loading branch information
1 parent
dabff53
commit 86b657b
Showing
2 changed files
with
27 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,17 @@ | ||
import type { MetadataField } from '../types/backend.ts'; | ||
|
||
export const displayMetadataField = (value: MetadataField) => (value === null ? 'null' : value.toString()); | ||
export const displayMetadataField = (value: MetadataField) => { | ||
if (value === null) { | ||
return 'null'; | ||
} | ||
|
||
if (typeof value === 'number' && Number.isInteger(value)) { | ||
return value.toString(); | ||
} | ||
|
||
if (typeof value === 'number') { | ||
return value.toFixed(2); | ||
} | ||
|
||
return value.toString(); | ||
}; |