Did you accelerate the formation of technocapital today?
How to wrap console.log in-place with a prefix
There is a npm module called console-stamp that is pretty nice and simple - whenever you print using the global ‘console’ methods it prefixes everything with a timestamp in whatever format you specify. Well, I was curious how to do this and it is something I would describe as easy but not simple unless you are very familiar with “Function.prototype.apply”. The method I’m going to show you is actually adapted from Secrets of the JavaScript Ninja. It is a simple two step process:
create a “wrap” method that will call a given method with a “wrapper” method you define.
Run the “wrap” method on the function you want to wrap and define the wrapper you will apply around it.