@skhemata/skhemata-form
Version:
Skhemata Form Web Component. This web component can be used as base web component when working with forms and inputs.
13 lines (12 loc) • 371 B
JavaScript
export default function toString(input) {
if (typeof input === 'object' && input !== null) {
if (typeof input.toString === 'function') {
input = input.toString();
} else {
input = '[object Object]';
}
} else if (input === null || typeof input === 'undefined' || (isNaN(input) && !input.length)) {
input = '';
}
return String(input);
}