class Shape {
get area() {
return this.width * this.height;
}
}
ES6 makes it easy to define classes, but you can’t have decorated functions. For that, you’ll still need to drop to using prototype
.
Shape.prototype.iterate = memoize(function () {
...
})
Same with non-method attributes.
Shape.prototype.template =
require('fs').readFileSync('./template.html', 'utf-8');