diff --git a/dist/lib/Validators.js b/dist/lib/Validators.js index 36d64b1..8e3f71e 100644 --- a/dist/lib/Validators.js +++ b/dist/lib/Validators.js @@ -1,14 +1,14 @@ "use strict"; -var MongoDB = require('mongodb'); -var Skmatc = require('skmatc'); +var MongoDB = require("mongodb"); +var Skmatc = require("skmatc"); function DefaultValidators() { return [ Skmatc.create(function (schema) { return schema === MongoDB.ObjectID; }, function (schema, data) { - return this.assert(!data || data instanceof MongoDB.ObjectID || (data._bsontype === 'ObjectID' && data.id), "Expected " + JSON.stringify(data) + " to be a valid MongoDB.ObjectID object"); - }, { name: 'ObjectID validation' }), + return this.assert(!data || data instanceof MongoDB.ObjectID || (data._bsontype === "ObjectID" && data.id), "Expected " + JSON.stringify(data) + " to be a valid MongoDB.ObjectID object"); + }, { name: "ObjectID validation" }), Skmatc.create(function (schema) { return schema === Buffer; }, function (schema, data) { - return this.assert(data && (data instanceof MongoDB.Binary || (data._bsontype === 'Binary' && data.buffer)), "Expected " + JSON.stringify(data) + " to be a valid MongoDB.Binary object"); - }, { name: 'Buffer validation' }) + return this.assert(data && (data instanceof MongoDB.Binary || (data._bsontype === "Binary" && data.buffer)), "Expected " + JSON.stringify(data) + " to be a valid MongoDB.Binary object"); + }, { name: "Buffer validation" }) ]; } exports.DefaultValidators = DefaultValidators; diff --git a/dist/lib/Validators.js.map b/dist/lib/Validators.js.map index 307cf9c..21dc38a 100644 --- a/dist/lib/Validators.js.map +++ b/dist/lib/Validators.js.map @@ -1 +1 @@ -{"version":3,"sources":["lib/Validators.ts"],"names":[],"mappings":";AAAA,IAAO,OAAO,WAAW,SAAS,CAAC,CAAC;AACpC,IAAO,MAAM,WAAW,QAAQ,CAAC,CAAC;AAElC;IACC,MAAM,CAAC;QACN,MAAM,CAAC,MAAM,CAAC,UAAA,MAAM,IAAI,OAAA,MAAM,KAAK,OAAO,CAAC,QAAQ,EAA3B,CAA2B,EAAE,UAAS,MAAM,EAAE,IAAI;YACzE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,IAAI,IAAI,YAAY,OAAO,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,SAAS,KAAK,UAAU,IAAI,IAAI,CAAC,EAAE,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,wCAAwC,CAAC,CAAC;QAC5L,CAAC,EAAE,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAC;QACnC,MAAM,CAAC,MAAM,CAAC,UAAA,MAAM,IAAI,OAAA,MAAM,KAAK,MAAM,EAAjB,CAAiB,EAAE,UAAS,MAAM,EAAE,IAAI;YAC/D,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,YAAY,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,sCAAsC,CAAC,CAAC;QAC3L,CAAC,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE,CAAC;KACjC,CAAC;AACH,CAAC;AATe,yBAAiB,oBAShC,CAAA","file":"lib/Validators.js","sourcesContent":["import MongoDB = require('mongodb');\r\nimport Skmatc = require('skmatc');\r\n\r\nexport function DefaultValidators() {\r\n\treturn [\r\n\t\tSkmatc.create(schema => schema === MongoDB.ObjectID, function(schema, data) {\r\n\t\t\treturn this.assert(!data || data instanceof MongoDB.ObjectID || (data._bsontype === 'ObjectID' && data.id), \"Expected \" + JSON.stringify(data) + \" to be a valid MongoDB.ObjectID object\");\r\n\t\t}, { name: 'ObjectID validation' }),\r\n\t\tSkmatc.create(schema => schema === Buffer, function(schema, data) {\r\n\t\t\treturn this.assert(data && (data instanceof MongoDB.Binary || (data._bsontype === 'Binary' && data.buffer)), \"Expected \" + JSON.stringify(data) + \" to be a valid MongoDB.Binary object\");\r\n\t\t}, { name: 'Buffer validation' })\r\n\t];\r\n}"],"sourceRoot":"/source/"} \ No newline at end of file +{"version":3,"sources":["lib/Validators.ts"],"names":[],"mappings":";AAAA,IAAO,OAAO,WAAW,SAAS,CAAC,CAAC;AACpC,IAAO,MAAM,WAAW,QAAQ,CAAC,CAAC;AAElC;IACC,MAAM,CAAC;QACN,MAAM,CAAC,MAAM,CAAC,UAAA,MAAM,IAAI,OAAA,MAAM,KAAK,OAAO,CAAC,QAAQ,EAA3B,CAA2B,EAAE,UAAS,MAAM,EAAE,IAAI;YACzE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,IAAI,IAAI,YAAY,OAAO,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,SAAS,KAAK,UAAU,IAAI,IAAI,CAAC,EAAE,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,wCAAwC,CAAC,CAAC;QAC5L,CAAC,EAAE,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAC;QACnC,MAAM,CAAC,MAAM,CAAC,UAAA,MAAM,IAAI,OAAA,MAAM,KAAK,MAAM,EAAjB,CAAiB,EAAE,UAAS,MAAM,EAAE,IAAI;YAC/D,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,YAAY,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,sCAAsC,CAAC,CAAC;QAC3L,CAAC,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE,CAAC;KACjC,CAAC;AACH,CAAC;AATe,yBAAiB,oBAShC,CAAA","file":"lib/Validators.js","sourcesContent":["import MongoDB = require(\"mongodb\");\r\nimport Skmatc = require(\"skmatc\");\r\n\r\nexport function DefaultValidators() {\r\n\treturn [\r\n\t\tSkmatc.create(schema => schema === MongoDB.ObjectID, function(schema, data) {\r\n\t\t\treturn this.assert(!data || data instanceof MongoDB.ObjectID || (data._bsontype === \"ObjectID\" && data.id), \"Expected \" + JSON.stringify(data) + \" to be a valid MongoDB.ObjectID object\");\r\n\t\t}, { name: \"ObjectID validation\" }),\r\n\t\tSkmatc.create(schema => schema === Buffer, function(schema, data) {\r\n\t\t\treturn this.assert(data && (data instanceof MongoDB.Binary || (data._bsontype === \"Binary\" && data.buffer)), \"Expected \" + JSON.stringify(data) + \" to be a valid MongoDB.Binary object\");\r\n\t\t}, { name: \"Buffer validation\" })\r\n\t];\r\n}"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/lib/Validators.ts b/lib/Validators.ts index 9c7ec79..cba668d 100644 --- a/lib/Validators.ts +++ b/lib/Validators.ts @@ -1,13 +1,13 @@ -import MongoDB = require('mongodb'); -import Skmatc = require('skmatc'); +import MongoDB = require("mongodb"); +import Skmatc = require("skmatc"); export function DefaultValidators() { return [ Skmatc.create(schema => schema === MongoDB.ObjectID, function(schema, data) { - return this.assert(!data || data instanceof MongoDB.ObjectID || (data._bsontype === 'ObjectID' && data.id), "Expected " + JSON.stringify(data) + " to be a valid MongoDB.ObjectID object"); - }, { name: 'ObjectID validation' }), + return this.assert(!data || data instanceof MongoDB.ObjectID || (data._bsontype === "ObjectID" && data.id), "Expected " + JSON.stringify(data) + " to be a valid MongoDB.ObjectID object"); + }, { name: "ObjectID validation" }), Skmatc.create(schema => schema === Buffer, function(schema, data) { - return this.assert(data && (data instanceof MongoDB.Binary || (data._bsontype === 'Binary' && data.buffer)), "Expected " + JSON.stringify(data) + " to be a valid MongoDB.Binary object"); - }, { name: 'Buffer validation' }) + return this.assert(data && (data instanceof MongoDB.Binary || (data._bsontype === "Binary" && data.buffer)), "Expected " + JSON.stringify(data) + " to be a valid MongoDB.Binary object"); + }, { name: "Buffer validation" }) ]; } \ No newline at end of file diff --git a/test/Cache.ts b/test/Cache.ts index 2c18115..20fbf43 100644 --- a/test/Cache.ts +++ b/test/Cache.ts @@ -77,7 +77,7 @@ describe("Cache",() => { }); it("should generate a key based on the object's ID",() => { - chai.expect(director.buildKey({ _id: "test' })).to.be.equal('test"); + chai.expect(director.buildKey({ _id: "test" })).to.be.equal("test"); }); it("should only report that queries which specify the _id field are usable",() => { @@ -86,7 +86,7 @@ describe("Cache",() => { }); it("should generate a key based on the query ID",() => { - chai.expect(director.buildQueryKey({ _id: "test' })).to.be.equal('test"); + chai.expect(director.buildQueryKey({ _id: "test" })).to.be.equal("test"); }); }); diff --git a/test/Core.ts b/test/Core.ts index 789b518..7ab01f1 100644 --- a/test/Core.ts +++ b/test/Core.ts @@ -49,7 +49,7 @@ describe("Core",() => { }); it("should throw an error if no URI or configuration object was provided",() => { - chai.expect(() => new Iridium.Core('')).to.throw("Expected either a URI or config object to be supplied when initializing Iridium"); + chai.expect(() => new Iridium.Core("")).to.throw("Expected either a URI or config object to be supplied when initializing Iridium"); }); describe("should correctly convert the configuration object into a URI string", () => {