Last active
May 22, 2017 14:14
-
-
Save animeoakes/72d0da365bfe4acfb494 to your computer and use it in GitHub Desktop.
console.log an object without fully displaying nested objects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function shallow_log(name, object) { | |
console.log(typeof(object)) | |
let tab = ' ' | |
console.log(name + ' {') | |
for (let property in object) { | |
let value = object[property] | |
if (_.isObject(value)) { | |
value = value.toString() | |
} | |
console.log(tab + property + ': ' + value + ',') | |
} | |
console.log('}') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment