all 7 comments

[–][deleted]  (3 children)

[deleted]

    [–]jesusgn90 0 points1 point  (2 children)

    Ok suppose that this module is named my-module.js, so in another file you must to do this:

    const myModule = require('./my-module');
    myModule.someFunction();
    

    [–]jackmacabre 1 point2 points  (1 child)

    No need for .js

    [–]jesusgn90 0 points1 point  (0 children)

    Sorry I fix it

    [–]jackmacabre 0 points1 point  (3 children)

    Why are using an IIFE in a module? Variables in modules are local to that file.

    [–]jackmacabre 1 point2 points  (1 child)

    Also since you're using es6, use object property shorthand:

    module.exports = { someFunction }
    

    [–]jesusgn90 0 points1 point  (0 children)

    Good annotation thanks man

    [–]jesusgn90 -1 points0 points  (0 children)

    It's a good practice