Playing Around with your Standard, Run-of-the-Mill #javascript Decorator Example
▻https://hackernoon.com/playing-around-with-your-standard-run-of-the-mill-javascript-decorator-e
JavaScript Decorators: fun with function parametersJavaScript decorators have been a language feature since #es2015 came out, but they are still largely ‘experimental’ in JavaScript engines that support it. What are they? If you’re familiar with Java, you know how methods can be wrapped through annotations. The gist of it: a decorator wraps a JavaScript class method within another function, and it is invoked by annotation.I’ll be using #nodejs for the example code, so there will be several modules, plugins, and configurations that are needed.Installationinitialize an npm projectinstall the babel command-line tools; we’ll be needing this to transpile the decorated methodsinstall plugins need for the transpilationnpm init -ynpm install —save babel-clinpm install —save-dev babel-eslint (...)