From e3fb2ceef680303fc143b219f195f3ea93f87055 Mon Sep 17 00:00:00 2001 From: Benjamin Pannell Date: Thu, 23 Jan 2014 12:34:55 +0200 Subject: [PATCH] Whitespace and VS project file improvements --- Iridium.csproj | 155 ---------------------------------------- Iridium.njsproj | 134 ++++++++++++++++++++++++++++++++++ Iridium.sln | 10 +-- lib/Database.js | 2 - lib/Instance.js | 4 +- lib/Model.js | 27 ++++--- lib/caches/NoOpCache.js | 2 +- test/model.js | 3 +- 8 files changed, 156 insertions(+), 181 deletions(-) delete mode 100644 Iridium.csproj create mode 100644 Iridium.njsproj diff --git a/Iridium.csproj b/Iridium.csproj deleted file mode 100644 index f2cf381..0000000 --- a/Iridium.csproj +++ /dev/null @@ -1,155 +0,0 @@ - - - - - Debug - AnyCPU - - - 2.0 - {A937B8F5-CB90-46AD-AB3C-1EBD8E827378} - {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - Iridium - Iridium - v4.5 - true - - - - - - - true - full - false - bin\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - - - - - True - True - 64607 - / - http://localhost:64607/ - False - False - - - False - - - - - - \ No newline at end of file diff --git a/Iridium.njsproj b/Iridium.njsproj new file mode 100644 index 0000000..7a73e52 --- /dev/null +++ b/Iridium.njsproj @@ -0,0 +1,134 @@ + + + + Debug + 2.0 + {a2511e8c-33be-4b8d-8203-70d403aa446a} + + ShowAllFiles + index.js + . + . + {3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{349c5851-65df-11da-9384-00065b846f21};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD} + 11.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + True + 0 + / + http://localhost:48022/ + False + True + http://localhost:1337 + False + + + + + + + CurrentPage + True + False + False + False + + + + + + + + + False + False + + + + + \ No newline at end of file diff --git a/Iridium.sln b/Iridium.sln index 35d73e4..9bd8174 100644 --- a/Iridium.sln +++ b/Iridium.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 VisualStudioVersion = 12.0.21005.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Iridium", "Iridium.csproj", "{A937B8F5-CB90-46AD-AB3C-1EBD8E827378}" +Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "Iridium", "Iridium.njsproj", "{A2511E8C-33BE-4B8D-8203-70D403AA446A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,10 +11,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A937B8F5-CB90-46AD-AB3C-1EBD8E827378}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A937B8F5-CB90-46AD-AB3C-1EBD8E827378}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A937B8F5-CB90-46AD-AB3C-1EBD8E827378}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A937B8F5-CB90-46AD-AB3C-1EBD8E827378}.Release|Any CPU.Build.0 = Release|Any CPU + {A2511E8C-33BE-4B8D-8203-70D403AA446A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A2511E8C-33BE-4B8D-8203-70D403AA446A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A2511E8C-33BE-4B8D-8203-70D403AA446A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A2511E8C-33BE-4B8D-8203-70D403AA446A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/lib/Database.js b/lib/Database.js index 39fff84..90bfbf1 100644 --- a/lib/Database.js +++ b/lib/Database.js @@ -1,4 +1,3 @@ -/// /// /// @@ -23,7 +22,6 @@ function Database(config) { Object.defineProperty(this, 'settings', { get: function () { - "use strict"; return config; }, enumerable: false diff --git a/lib/Instance.js b/lib/Instance.js index a44a79e..7e9f300 100644 --- a/lib/Instance.js +++ b/lib/Instance.js @@ -50,7 +50,7 @@ function Instance(model, doc, isNew) { this.emit('ready', this); } -Instance.prototype.prototype = EventEmitter.prototype; +Instance.prototype.__proto__ = EventEmitter.prototype; Object.defineProperty(Instance.prototype, 'document', { get: function() { return this.__state.modified; }, @@ -351,7 +351,7 @@ Instance.forModel = function(model) { }); }); - proto.prototype = Instance.prototype; + proto.__proto__ = Instance.prototype; _.each(model.options.methods, function(method, name) { proto[name] = method; diff --git a/lib/Model.js b/lib/Model.js index 8b42e9b..a73f864 100644 --- a/lib/Model.js +++ b/lib/Model.js @@ -1,5 +1,4 @@ -/// -/// +/// /// /// @@ -82,19 +81,19 @@ function Model(database, collection, schema, options) { var _instance = null; Object.defineProperty(this, 'Instance', { - get: function() { return _instance = _instance || Instance.forModel(this) }, + get: function () { return _instance = _instance || Instance.forModel(this); }, enumerable: false }); var _cache = options.cache; Object.defineProperty(this, 'cache', { - get: function() { return _cache = _cache || new NoOpCache(); }, + get: function () { return _cache = _cache || new NoOpCache(); }, enumerable: false - }) + }); - var extraValidators = []; - for(var i = 0; i < database.plugins.length; i++) { + var i, extraValidators = []; + for(i = 0; i < database.plugins.length; i++) { if(database.plugins[i].validate) extraValidators.push(database.plugins[i].validate); } @@ -103,7 +102,7 @@ function Model(database, collection, schema, options) { get: function() { return extraValidators; } }); - for(var i = 0; i < database.plugins.length; i++) { + for(i = 0; i < database.plugins.length; i++) { if(database.plugins[i].newModel) database.plugins[i].newModel.call(this, database, collection, schema, options); } } @@ -549,21 +548,21 @@ Model.prototype.insert = Model.prototype.create = function (object, options, cal }).bind(this); async.parallel(_.map(object, function(obj) { - return function(done) { - var postHook = function(err) { - if(err) return done(err); + return function (done) { + var postHook = function (err) { + if (err) return done(err); // Validate the object var validation = validate($.schema, obj, undefined, $.extraValidators); - if(!validation.passed) return done(validation.toError()); + if (!validation.passed) return done(validation.toError()); // Transform the object $.toSource(obj); return done(null, obj); - } + }; $.onCreating(obj, postHook); - } + }; }, this), prepComplete); }; diff --git a/lib/caches/NoOpCache.js b/lib/caches/NoOpCache.js index 355be23..ebde511 100644 --- a/lib/caches/NoOpCache.js +++ b/lib/caches/NoOpCache.js @@ -8,7 +8,7 @@ function NoOpCache(options) { NoOpCache.prototype.valid = function(conditions) { /// Determines whether or not an object with the given conditions can be retrieved from this cache /// The conditions for which the document was retrieved - /// + /// }; NoOpCache.prototype.store = function(conditions, document, callback) { diff --git a/test/model.js b/test/model.js index b60b6f9..31eae8c 100644 --- a/test/model.js +++ b/test/model.js @@ -1,5 +1,4 @@ -/// -/// +/// /// ///