@scania/tegel
Version:
Tegel Design System
15 lines (14 loc) • 483 B
JavaScript
/**
* Converts a value (string or number) to string
* @param value - The value to convert
* @returns The string representation of the value, or empty string if null/undefined
*/
export const convertToString = (value) => {
if (value === null || value === undefined)
return '';
return value.toString();
};
// Optional: If we need array conversion often
export const convertArrayToStrings = (values) => {
return values.map((value) => convertToString(value));
};