Skip to content

Instantly share code, notes, and snippets.

@OliverJAsh
Created November 13, 2014 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OliverJAsh/cc255a955849634c11e3 to your computer and use it in GitHub Desktop.
Save OliverJAsh/cc255a955849634c11e3 to your computer and use it in GitHub Desktop.
Given some nested data, what are the different options for logging in Node?
/**
* Given some nested data, what are the different options for logging in Node?
*/
var a = [
{
"data": {
"url": "http://theguardian.com/",
"feeds": [
{
"href": "http://feeds.theguardian.com/theguardian/uk/rss",
"title": "rss"
}
],
"title": " Latest news, sport and comment from the Guardian | The Guardian ",
"icon": "http://static.guim.co.uk/favicon.ico"
},
"uri": "http://api.sbscribe.dev/websites/http%3A%2F%2Ftheguardian.com%2F"
},
{
"data": {
"url": "http://theverge.com/",
"feeds": [
{
"href": "http://www.theverge.com/rss/index.xml",
"title": "The Verge - All Posts"
}
],
"title": "The Verge",
"icon": "http://cdn0.vox-cdn.com/images/verge/2.0/verge-icon-196x196.v503bbf1.png"
},
"uri": "http://api.sbscribe.dev/websites/http%3A%2F%2Ftheverge.com%2F"
},
{
"data": {
"url": "http://mattandrews.info/",
"feeds": [],
"title": "Matt Andrews | Personal site",
"icon": "http://mattandrews.info/matt/assets/img/icon/32.png"
},
"uri": "http://api.sbscribe.dev/websites/http%3A%2F%2Fmattandrews.info%2F"
},
{
"data": {
"url": "http://james.sl/blog/",
"feeds": [
{
"href": "/blog/feed.xml",
"title": "Atom Feed"
}
],
"title": "James a nomad traveler"
},
"uri": "http://api.sbscribe.dev/websites/http%3A%2F%2Fjames.sl%2Fblog%2F"
},
{
"data": {
"url": "http://www.macstories.net/",
"feeds": [
{
"href": "http://www.macstories.net/feed/",
"title": "MacStories"
},
{
"href": "http://www.macstories.net/?feed=articles-only",
"title": "MacStories — Articles Only"
}
],
"title": "MacStories",
"icon": "http://www.macstories.net/app/themes/macstories4/images/favicon.png"
},
"uri": "http://api.sbscribe.dev/websites/http%3A%2F%2Fwww.macstories.net%2F"
},
{
"data": {
"url": "http://www.paulirish.com/",
"feeds": [
{
"href": "http://feeds.feedburner.com/paul-irish",
"title": "Paul Irish"
}
],
"title": "Paul Irish"
},
"uri": "http://api.sbscribe.dev/websites/http%3A%2F%2Fwww.paulirish.com%2F"
},
{
"data": {
"url": "https://medium.com/@izs",
"feeds": [
{
"href": "/feed/@izs",
"title": "RSS"
}
],
"title": "isaacs — Medium",
"icon": "/apple-touch-icon-precomposed-152.png"
},
"uri": "http://api.sbscribe.dev/websites/https%3A%2F%2Fmedium.com%2F%40izs"
},
{
"data": {
"url": "http://ariya.ofilabs.com/",
"feeds": [],
"title": "\n\t\t\tdon't code today what you can't debug tomorrow - \n\t\t",
"icon": "http://ariya.ofilabs.com/wp-content/themes/wordpress-bootstrap/library/images/icons/l/apple-touch-icon.png"
},
"uri": "http://api.sbscribe.dev/websites/http%3A%2F%2Fariya.ofilabs.com%2F"
},
{
"data": {
"url": "http://blog.alexmaccaw.com/",
"feeds": [
{
"href": "http://blog.alexmaccaw.com/feed",
"title": null
}
],
"title": "Alex MacCaw",
"icon": "https://dtu1xr3i3b2a1.cloudfront.net/cargo/favicon-3f2f2a1515946b13c16f10c8907322e0.ico"
},
"uri": "http://api.sbscribe.dev/websites/http%3A%2F%2Fblog.alexmaccaw.com%2F"
},
{
"data": {
"url": "http://www.2ality.com/",
"feeds": [
{
"href": "http://www.2ality.com/feeds/posts/default?alt=rss",
"title": "②ality – JavaScript and more - RSS"
},
{
"href": "http://www.2ality.com/feeds/posts/default",
"title": "②ality – JavaScript and more - Atom"
},
{
"href": "http://www.blogger.com/feeds/8100407163665430627/posts/default",
"title": "②ality – JavaScript and more - Atom"
}
],
"title": "②ality – JavaScript and more",
"icon": "http://www.2ality.com/favicon.ico"
},
"uri": "http://api.sbscribe.dev/websites/http%3A%2F%2Fwww.2ality.com%2F"
},
{
"data": {
"url": "https://medium.com/@kevinrose",
"feeds": [
{
"href": "/feed/@kevinrose",
"title": "RSS"
}
],
"title": "Kevin Rose — Medium",
"icon": "/apple-touch-icon-precomposed-152.png"
},
"uri": "http://api.sbscribe.dev/websites/https%3A%2F%2Fmedium.com%2F%40kevinrose"
},
{
"data": {
"url": "http://tom.preston-werner.com/",
"feeds": [
{
"href": "http://feeds.feedburner.com/tom-preston-werner",
"title": "Tom Preston-Werner"
}
],
"title": "Tom Preston-Werner"
},
"uri": "http://api.sbscribe.dev/websites/http%3A%2F%2Ftom.preston-werner.com%2F"
},
{
"data": {
"url": "http://theramblingtour.smugglersrecords.com/",
"feeds": [
{
"href": "http://theramblingtour.smugglersrecords.com/?feed=rss2",
"title": "The Rambling Tour 2014 - Will Varley » Feed"
},
{
"href": "http://theramblingtour.smugglersrecords.com/?feed=comments-rss2",
"title": "The Rambling Tour 2014 - Will Varley » Comments Feed"
},
{
"href": "http://theramblingtour.smugglersrecords.com/?feed=gigpress",
"title": "Upcoming shows"
}
],
"title": ""
},
"uri": "http://api.sbscribe.dev/websites/http%3A%2F%2Ftheramblingtour.smugglersrecords.com%2F"
}
];
var util = require('util');
// 1
// Boring indentation
// console.log(a);
// 2
// Correct indentation
// Tabs
// console.log(JSON.stringify(a, null, '\t'));
// Spaces
// console.log(JSON.stringify(a, null, ' '));
// 3
// Same as 1
// console.log(util.inspect(a));
// 4
// console.log(util.inspect(a, { depth: null }));
// OR
// console.log(util.inspect(a, false, null));
// 5
// console.log('%j', a);
// 6
// Same as 5
// console.log(util.format('%j', a));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment