Skip to content

Instantly share code, notes, and snippets.

@kamilogorek
Created January 10, 2024 15:04
Show Gist options
  • Save kamilogorek/ba18f5fce5ca1893dbfbabd75969926a to your computer and use it in GitHub Desktop.
Save kamilogorek/ba18f5fce5ca1893dbfbabd75969926a to your computer and use it in GitHub Desktop.
function prefixer(prefix) {
return function (...data) {
console.log(
data
.map((d) => JSON.stringify(d, null, 2))
.join(" ")
.split("\n")
.map((line) => `${prefix}${line}`)
.join("\n")
);
};
}
const lovelyPrefixer = prefixer("lovely: ");
lovelyPrefixer("some log", { foo: "bar", baz: {} }, "other log", [1, 2, 3]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment