No, you're thinking of `destructuring`. CommonJS was "just" a common format for defining/importing modules in a NodeJS environment (via `module.exports` and `require`), eventually being used for packaging frontend "applications" as well, popularized by Browserify.
To expand, the following was common before destructuring but with CommonJS:
var some_func= require('some_module').some_func
Which, as you know, would probably usually be done like this today, where we have destructuring:
Comments
Isn't this exactly what CommonJS does/did?
No, you're thinking of `destructuring`. CommonJS was "just" a common format for defining/importing modules in a NodeJS environment (via `module.exports` and `require`), eventually being used for packaging frontend "applications" as well, popularized by Browserify.
To expand, the following was common before destructuring but with CommonJS:
Which, as you know, would probably usually be done like this today, where we have destructuring: