name:
src/main/js/common/utils/Convert.ts
-rw-r--r--
481
1/**
2 * If a value is null-ish (null or undefined) convert it to an empty string, otherwise convert it to a string.
3 * @param value to convert
4 */
5export function nullableToString(value: any): string {
6 if (value === null || value === undefined) {
7 return "";
8 }
9 return value.toString();
10}
11
12/**
13 * Pull the values from an object.
14 * @param object
15 */
16export function objectValues<T>(object: { [index: string]: T }) {
17 return Object.keys(object).map((key) => object[key]);
18}