Socket
Socket
Sign inDemoInstall

mongoose-model-loader

Package Overview
Dependencies
6
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.3 to 0.0.4

test/fixtures/models/account.js

7

lib/index.js

@@ -21,3 +21,8 @@

debug('loading model %s', modelName)
mongoose.model(modelName, new Schema(model))
if (!(model instanceof Schema)) {
model = new Schema(model)
}
mongoose.model(modelName, model)
}

@@ -24,0 +29,0 @@ })

2

package.json
{
"name": "mongoose-model-loader",
"version": "0.0.3",
"version": "0.0.4",
"description": "Load Mongoose models from a directory.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

# mongoose-model-loader
Load Mongoose models from a directory
## Installation
$ npm install mongoose-model-loader
## Usage
```js
var loader = require('mongoose-model-loader')
var mongoose = require('mongoose')
// Load models from a directory
loader(__dirname + '/models')
// Access models
var MyModel = mongoose.model('MyModel')
var AnotherModel = mongoose.model('AnotherModel')
```
## License
MIT

@@ -20,3 +20,3 @@

before(function () {
loader(__dirname + '/models')
loader(__dirname + '/fixtures/models')
})

@@ -39,2 +39,6 @@

})
it('should load a model that is of type Schema', function () {
mongoose.model('Account').should.exist
})
})
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