Last active
March 27, 2022 10:48
-
-
Save tahashieenavaz/7bb2c7a19034ab3961f1f1b009bbd225 to your computer and use it in GitHub Desktop.
I often find myself thinking about using table or log method from console class. So to be more productive and consistent I created a little helper function for myself.
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 characters
function l() { | |
const argumentsArray = Array.from(arguments); | |
const strings = argumentsArray.filter( | |
($arg) => $arg instanceof String || typeof $arg == "string" | |
); | |
const objects = argumentsArray.filter( | |
($arg) => !($arg instanceof String || typeof $arg == "string") | |
); | |
if (strings.length) { | |
console.log("[STRINGS]"); | |
console.table(strings); | |
} | |
if (objects.length) { | |
console.log("[OBJECTS]"); | |
objects.forEach(($object) => console.table($object)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment