How can "sequelize.import()" import models from another file?
<p>When I create a new model in the following way:</p>

<pre><code>//user.js file
module.exports = function (sequelize, DateTypes) {

return sequelize.define("user", {
    email: {
        type: DateTypes.STRING,
        allowNull: false,
        unique: true,
        validate: {
            isEmail: true
        }
    },
    password: {
        type: DateTypes.STRING,
        allowNull: false,
        validate: {
            len: [7, 100]
        }
    }
});
};
</code></pre>

<p>and into db.js file where i built a new database:</p>

<pre><code>var Sequelize = require('sequelize');
var env = process.env.NODE_ENV || "development"; // established if you work in production or in development mode
var sequelize;

if (env == "production") {
    sequelize = new Sequelize(process.env.DATABASE_URL, {
        "dialect": "postgres",

    });
} else {
    var sequelize = new Sequelize(undefined, undefined, undefined, {
        'dialect': 'sqlite',
        'storage': __dirname + '/data/dev-todo-api.sqlite' // location where you create a new sqlite database 
    });
}

var db = {};

db.todo = sequelize.import(__dirname + "/models/todo.js");
db.user = sequelize.import(__dirname + "/models/user.js");
db.sequelize = sequelize; //contain a settings of database
db.Sequelize = Sequelize;

module.exports = db;
</code></pre>

<p>I don't understand how user.js knows that <code>sequelize</code> (that I insert as a parameter into <code>module.exports</code>) is the instance of a sequelize package if it is situated into another file? Maybe because with <code>sequelize.import('/user.js')</code> it imports the entire sequelize package?</p>