outers
Version:
outers - a all in one package for your day to day use
31 lines • 1.33 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreateSchema = void 0;
/* eslint-disable @typescript-eslint/no-explicit-any */
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