5

This is Node.js FYI

Exporting a single class from a file called util.js. This class only has static methods. Each method is a util function. No fucking way of importing a single method. Class abuse?

Comments
  • 2
    Depends on cohesion of methods, size of class
  • 1
    var { methodName } = require("./util.js");
  • 1
    @craig939393 It's not like they depend on each other in any way, and most of them have nothing to do with each other.

    @theabbie I failed to mention that we're using ES6 imports which makes that impossible.
  • 2
    This is code smell and would not pass my code review.
  • 1
    Class abuse yes. If all functions are static, might as well just exported that function instead of creating a class.
  • 1
    @rooter @abrd17 Precisely. I'm not the one who wrote this...
Add Comment