the title might be confusing so here's what I mean, let's say I have this script
information.js
const a = () => console.log('a')
const b = () => console.log('b')
module.exports.b = b
a()
b()
(notice the module.exports of b because this function is so cool I want to make it available in my workspace)
node information.js outputs a\nb as expected.
Now let say I want to import the b in another module. In order to simulate this behavior I just run node on the command line and type const {b} = require('./information.js'). b is imported correctly but I still have the output a\nb.
What condition should I wrap a();b() with in information.js so it does not get executed when the file is used for module importation ?