swc/bundler/tests/.cache/deno/552946951b4b80b2c8e7a6ad38379fd26d613ac4.ts
강동윤 bbaf619f63
fix(bundler): Fix bugs (#1437)
swc_bundler:
 - [x] Fix wrapped esms. (denoland/deno#9307)
 - [x] Make test secure.
2021-03-02 17:33:03 +09:00

21 lines
463 B
TypeScript

// Loaded from https://deno.land/x/segno@v1.1.0/lib/helpers/toString.ts
export const toString = (input: any) => {
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);
};