23 lines
485 B
JavaScript
23 lines
485 B
JavaScript
'use strict';
|
|
|
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
|
function toString(value) {
|
|
if (value == null) {
|
|
return '';
|
|
}
|
|
if (typeof value === 'string') {
|
|
return value;
|
|
}
|
|
if (Array.isArray(value)) {
|
|
return value.map(toString).join(',');
|
|
}
|
|
const result = String(value);
|
|
if (result === '0' && Object.is(Number(value), -0)) {
|
|
return '-0';
|
|
}
|
|
return result;
|
|
}
|
|
|
|
exports.toString = toString;
|