Skip to content

Instantly share code, notes, and snippets.

@tahashieenavaz
Last active March 27, 2022 10:48
Show Gist options
  • Save tahashieenavaz/7bb2c7a19034ab3961f1f1b009bbd225 to your computer and use it in GitHub Desktop.
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.
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