hkirat/notification-logger

Unwrap Objects while Logging them as Desktop Notifications

Opened this issue · 3 comments

Hey,

Great idea on the script! As far as unwrapping objects would you just use JSON.stringify?

Thanks
Seems like a good fix. Didn't knew something like this existed.

@hkirat Using JSON.stringify will result in outputs like

JSON.stringify([1, 'false', false]); // '[1,"false",false]'

JSON.stringify(new Date(2006, 0, 2, 15, 4, 5)) 
// '"2006-01-02T15:04:05.000Z"'

JSON.stringify({ x: 5, y: 6 });
// '{"x":5,"y":6}' or '{"y":6,"x":5}'
JSON.stringify([new Number(1), new String('false'), new Boolean(false)]);
// '[1,"false",false]'

JSON.stringify({ x: [10, undefined, function(){}, Symbol('')] }); 
// '{"x":[10,null,null,null]}' 

Is this what we're trying to achieve?

@jarifibrahim What we really want to achieve is something like we have in the js console in our browsers.
That is, an arrow on the left when the current variable is an array or an object clicking on which it will expand it so that we can see the contents inside