string-any
is a package to convert any object to a string and not [object Object]
const { toStr } = require('string-any');
// objects
toStr(
{
name: "name",
id: 32918,
randomThing: {
dwq: "hello"
},
func: () => "hello"
}
);
// => "{
// => name: "name",
// => id: 32918,
// => randomThing: {
// => dwq: "hello"
// => },
// => func: () => "hello"
// => }"
// functions
toStr(() => {}) // => "() => {}"
// numbers
toStr(10) // => "10"
// Strings
toStr("hello") // => '"hello"'
// String Objects
toStr(new String("hello")) // => "hello"
// Arrays
toStr([1,2,3]) // => "[1, 2, 3]"
MIT License
Copyright (c) 2019 AliBasicCoder