UNPKG

@stacksjs/ts-validation

Version:

A simple TypeScript starter kit using Bun.

14 lines (12 loc) 391 B
export default function toString(input: any): string { if (input === null || typeof input === 'undefined') { return '' } if (typeof input === 'object' && input !== null) { input = typeof input.toString === 'function' ? input.toString() : Object.prototype.toString.call(input) } else if (input === 0 && Object.is(input, -0)) { return '-0' } return String(input) };