UNPKG

iridium

Version:

A custom lightweight ORM for MongoDB designed for power-users

16 lines 935 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const MongoDB = require("mongodb"); const Skmatc = require("skmatc"); 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" }), 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" }) ]; } exports.DefaultValidators = DefaultValidators; //# sourceMappingURL=Validators.js.map