@scania/tegel
Version:
Tegel Design System
17 lines (15 loc) • 531 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
*/
const convertToString = (value) => {
if (value === null || value === undefined)
return '';
return value.toString();
};
// Optional: If we need array conversion often
const convertArrayToStrings = (values) => {
return values.map((value) => convertToString(value));
};
export { convertArrayToStrings as a, convertToString as c };