Socket
Socket
Sign inDemoInstall

sequelize-singleton

Package Overview
Dependencies
10
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.0 to 0.2.1

10

lib/singleton.js

@@ -19,2 +19,5 @@ "use strict";

if(db.logger)
console.log("Connecting to: " + database + " as: " + username);
// Instanciate a new sequelize instance

@@ -44,2 +47,6 @@ var sequelize = new db.Sequelize(database, username, password, options);

Object.keys(db.models).forEach(function(modelName) {
if(db.logger)
console.log("Associating Model: "+ modelName);
if ("associate" in db.models[modelName]) {

@@ -54,2 +61,5 @@ db.models[modelName].associate(db.models);

if(db.logger)
console.log("Finished Connecting");
return true;

@@ -56,0 +66,0 @@ };

6

package.json
{
"name": "sequelize-singleton",
"version": "0.2.0",
"version": "0.2.1",
"author": "Jacob Spizziri <jacob.spizziri@gmail.com> (https://github.com/jspizziri)",

@@ -20,6 +20,6 @@ "license": "BSD-2-Clause",

],
"dependencies": {
"mysql": "^2.5.4",
"dependencies" : {},
"peerDependencies": {
"sequelize": "^2.0.0-rc8"
}
}

@@ -12,3 +12,3 @@ # sequelize-singleton

The sequelize-singleton ```connect()``` argument accepts the same parameters as the Sequelize() object. It is important to configure the ```discover``` array of the set of paths where your models should be discovered.
The sequelize-singleton ```connect()``` method accepts the same parameters as the Sequelize() object ```database, username, password, options```. It is important to configure the ```discover``` array of the set of paths where your models should be discovered.
```

@@ -28,7 +28,9 @@ // app.js

```
Upon ```connect()``` sequelize-singleton will SYNCHRONOUSLY recurse through the provided file paths looking for any files with the naming convention ```*.model.js```.
Upon ```connect()``` sequelize-singleton will ***SYNCHRONOUSLY recurse*** through all of the subfolders located at the provided file paths looking for any files with the naming default convention ```*.model.js```.
## Custom matcher
Alternatively you can define a custom matching function which returns a ```boolean``` and attach it to:
If you prefer to define your own naming convention instead of the default you can create a custom matching function which receives the file name as the parameter returns a ```boolean``` indicating if sequelize-singleton should attempt to load the file as a model.
This function should be attached to ```matcher``` like so:
```

@@ -35,0 +37,0 @@ orm.matcher = function(file){

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc