1
require('../models/owners.js')(sequelize, Sequelize);

I don't understand the syntax of having require(..something)(why?) next to each other?

MVR
  • 45
  • 6
  • You are calling a constructor function for the module, as described here https://stackoverflow.com/a/7367898/8678978 Are `sequelize` and `Sequelize` declared somewhere else in your file? – chrisbyte Dec 12 '19 at 00:14

1 Answers1

3
require('../models/owners.js')(sequelize, Sequelize);

The above is (pretty much) equivalent to

const owners = require('../models/owners.js');
owners(sequelize, Sequelize);

However the second example results in a constant called owners as well.

Bergi
  • 630,263
  • 148
  • 957
  • 1,375
Olian04
  • 6,480
  • 2
  • 27
  • 54