notification-logger icon indicating copy to clipboard operation
notification-logger copied to clipboard

Unwrap Objects while Logging them as Desktop Notifications

Open mattpilott opened this issue 8 years ago • 3 comments

Hey,

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

mattpilott avatar Oct 14 '16 17:10 mattpilott

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

hkirat avatar Oct 14 '16 19:10 hkirat

@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 avatar Oct 17 '16 07:10 jarifibrahim

@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

hkirat avatar Oct 18 '16 18:10 hkirat