From 34dd01991abc8b2680b5254cd346edad47e0941b Mon Sep 17 00:00:00 2001 From: Benjamin Pannell Date: Thu, 20 Mar 2014 15:32:33 +0200 Subject: [PATCH] Normalized require() for local files Should make it (more) compatible with Node.js Tools for Visual Studio --- index.js | 2 +- lib/Database.js | 4 ++-- lib/Instance.js | 6 +++--- lib/Model.js | 10 +++++----- lib/utils/validation.js | 2 +- test/cache.js | 6 ++---- test/findOne.js | 4 ++-- test/hooks.js | 4 ++-- test/insertion.js | 4 ++-- test/instance_db.js | 2 +- test/instance_helpers.js | 2 +- test/instance_setup.js | 2 +- test/model.js | 4 ++-- test/plugins.js | 2 +- test/validation.js | 2 +- 15 files changed, 27 insertions(+), 29 deletions(-) diff --git a/index.js b/index.js index 8b56a66..d1ef699 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -var Database = require('./lib/Database'); +var Database = require('./lib/Database.js'); var Concoction = require('concoction'); Database.Concoction = Concoction; diff --git a/lib/Database.js b/lib/Database.js index 8535789..a83b18b 100644 --- a/lib/Database.js +++ b/lib/Database.js @@ -1,6 +1,6 @@ var MongoClient = require('mongodb').MongoClient; -var Model = require('./Model'); -var Instance = require('./Instance'); +var Model = require('./Model.js'); +var Instance = require('./Instance.js'); var _ = require('lodash'); (require.modules || {}).Database = module.exports = Database; diff --git a/lib/Instance.js b/lib/Instance.js index a6b087c..d59aff5 100644 --- a/lib/Instance.js +++ b/lib/Instance.js @@ -3,9 +3,9 @@ var ObjectID = require('mongodb').ObjectID, EventEmitter = require('events').EventEmitter, debug = require('debug')('iridium:Instance'), - inherit = require('./utils/Inherit'), - validate = require('./utils/validation'), - diff = require('./utils/diff'); + inherit = require('./utils/Inherit.js'), + validate = require('./utils/validation.js'), + diff = require('./utils/diff.js'); (require.modules || {}).Instance = module.exports = Instance; diff --git a/lib/Model.js b/lib/Model.js index 6526c1d..6ac5c9f 100644 --- a/lib/Model.js +++ b/lib/Model.js @@ -5,11 +5,11 @@ EventEmitter = require('events').EventEmitter, Concoction = require('concoction'), - inherit = require('./utils/Inherit'), - Database = require('./Database'), - Instance = require('./Instance'), - validate = require('./utils/validation'), - NoOpCache = require('./caches/NoOpCache'); + inherit = require('./utils/Inherit.js'), + Database = require('./Database.js'), + Instance = require('./Instance.js'), + validate = require('./utils/validation.js'), + NoOpCache = require('./caches/NoOpCache.js'); (require.modules || {}).Model = module.exports = Model; diff --git a/lib/utils/validation.js b/lib/utils/validation.js index 6c7d168..be6d5d0 100644 --- a/lib/utils/validation.js +++ b/lib/utils/validation.js @@ -1,5 +1,5 @@ var _ = require('lodash'); -require('./String'); +require('./String.js'); (require.modules || {}).validation = module.exports = validateType; diff --git a/test/cache.js b/test/cache.js index 5c2780f..f66599e 100644 --- a/test/cache.js +++ b/test/cache.js @@ -1,7 +1,5 @@ -/// - -var config = require('./config'); -var Database = require('../'); +var config = require('./config.js'); +var Database = require('../index.js'); var Model = Database.Model; var Instance = Database.Instance; var should = require('should'); diff --git a/test/findOne.js b/test/findOne.js index 28ea31b..a8540fc 100644 --- a/test/findOne.js +++ b/test/findOne.js @@ -1,5 +1,5 @@ -var config = require('./config'); -var Database = require('../index'); +var config = require('./config.js'); +var Database = require('../index.js'); var Model = Database.Model; var Instance = Database.Instance; var should = require('should'); diff --git a/test/hooks.js b/test/hooks.js index 034ddef..930f96b 100644 --- a/test/hooks.js +++ b/test/hooks.js @@ -1,10 +1,10 @@ var should = require('should'), - Database = require('../'), + Database = require('../index.js'), Model = Database.Model, Instance = Database.Instance; describe('hooks', function() { - var db = new Database(require('./config')); + var db = new Database(require('./config.js')); before(function(done) { db.connect(done); diff --git a/test/insertion.js b/test/insertion.js index 4ec6653..3ed3709 100644 --- a/test/insertion.js +++ b/test/insertion.js @@ -1,5 +1,5 @@ -var config = require('./config'); -var Database = require('../'); +var config = require('./config.js'); +var Database = require('../index.js'); var Model = Database.Model; var Instance = Database.Instance; var should = require('should'); diff --git a/test/instance_db.js b/test/instance_db.js index 1101c72..cd21cf0 100644 --- a/test/instance_db.js +++ b/test/instance_db.js @@ -1,4 +1,4 @@ -var Database = require('../'); +var Database = require('../index.js'); var Model = Database.Model; var Instance = Database.Instance; var should = require('should'); diff --git a/test/instance_helpers.js b/test/instance_helpers.js index 2216513..fa38ad6 100644 --- a/test/instance_helpers.js +++ b/test/instance_helpers.js @@ -1,4 +1,4 @@ -var Database = require('../'); +var Database = require('../index.js'); var Model = Database.Model; var Instance = Database.Instance; var should = require('should'); diff --git a/test/instance_setup.js b/test/instance_setup.js index 288dddd..837bc3c 100644 --- a/test/instance_setup.js +++ b/test/instance_setup.js @@ -1,4 +1,4 @@ -var Database = require('../'); +var Database = require('../index.js'); var Model = Database.Model; var Instance = Database.Instance; var should = require('should'); diff --git a/test/model.js b/test/model.js index a44e993..212158b 100644 --- a/test/model.js +++ b/test/model.js @@ -1,5 +1,5 @@ -var config = require('./config'); -var Database = require('../'); +var config = require('./config.js'); +var Database = require('../index.js'); var Model = Database.Model; var Instance = Database.Instance; var should = require('should'); diff --git a/test/plugins.js b/test/plugins.js index 8c26fd2..9e61850 100644 --- a/test/plugins.js +++ b/test/plugins.js @@ -1,4 +1,4 @@ -var Database = require('../'); +var Database = require('../index.js'); var Model = Database.Model; var Instance = Database.Instance; var should = require('should'); diff --git a/test/validation.js b/test/validation.js index 8ab86cb..189fa63 100644 --- a/test/validation.js +++ b/test/validation.js @@ -4,7 +4,7 @@ var should = require('should'); describe('utils', function () { describe('validation', function () { - var validation = require('../lib/utils/validation'); + var validation = require('../lib/utils/validation.js'); function validate(schema, value, pass, message, extra) { var result = validation(schema, value, '', extra); result.should.have.ownProperty('passed', pass, message);