UNPKG

mongosuper

Version:

mongosuper is a superset of mongoose. It is a wrapper around mongoose. It manage your mongoose connection and keep it alive always. It also provide you some extra features like CRUD operations, etc.

40 lines 1.75 kB
(function (factory) { if (typeof module === "object" && typeof module.exports === "object") { var v = factory(require, exports); if (v !== undefined) module.exports = v; } else if (typeof define === "function" && define.amd) { define(["require", "exports", "mongoose"], factory); } })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CreateSchema = void 0; const mongoose_1 = require("mongoose"); // Import mongoose types /** * This function creates a new schema object based on the provided data, and returns it or undefined if * there was an error. * @param {globe} Data - The parameter `Data` is of type `globe`, which is not a standard JavaScript * type. It is likely a custom type defined elsewhere in the codebase. Without knowing the definition * of `globe`, it is difficult to determine what kind of data this parameter expects. * @returns The function `CreateSchema` is returning either an instance of the `Schema` class created * with the `Data` parameter, or `undefined` if an error occurs during the creation of the schema. */ function CreateSchema(Data, isTimeStamps) { try { switch (Data) { case undefined: console.log("Schema is undefined"); return; default: return new mongoose_1.Schema(Data, { timestamps: isTimeStamps }); } } catch (err) { console.log(err); return undefined; } } // end of function exports.CreateSchema = CreateSchema; }); //# sourceMappingURL=CreateSchema.js.map