Last active
September 13, 2022 02:34
Revisions
-
Kye Hohenberger revised this gist
Mar 1, 2016 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,19 +1,19 @@ const a = { foo: 'bar' }; const b = 'I like cookies'; export const logWithLabel = (content, label, collapsed = false) => { if (__DEVELOPMENT__) { content = Array.isArray(content) ? content : [content]; console[collapsed ? 'groupCollapsed' : 'group'](label.toUpperCase()); content.forEach((c) => { if (Array.isArray(c) && Object.prototype.toString.call(c[0]) === '[object Object]') { return console.table(c, Object.keys(c[0])); } if (Object.prototype.toString.call(c) === '[object Object]') { return console.dir(c); } -
Kye Hohenberger revised this gist
Mar 1, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ export const logWithLabel = (content, label) => { return console.table(c, Object.keys(c[0])); } if (if (Object.prototype.toString.call(c) === '[object Object]') { return console.dir(c); } -
Kye Hohenberger revised this gist
Mar 1, 2016 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,6 @@ const a = { foo: 'bar' }; const b = 'I like cookies'; export const logWithLabel = (content, label) => { if (__DEVELOPMENT__) { @@ -23,4 +26,6 @@ export const logWithLabel = (content, label) => { }); console.groupEnd(); } }; //logWithLabel([a, b], 'Received'); -
Kye Hohenberger created this gist
Mar 1, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ export const logWithLabel = (content, label) => { if (__DEVELOPMENT__) { content = Array.isArray(content) ? content : [content]; console.groupCollapsed(label.toUpperCase()); content.forEach((c) => { if (Array.isArray(c) && Object.prototype.toString.call(c[0]) === '[object Object]') { return console.table(c, Object.keys(c[0])); } if (isPlainObject(c)) { return console.dir(c); } let message = c; if (typeof c === 'string') { message = `"${c}"`; } console.log(message); }); console.groupEnd(); } };