UNPKG

auto-typegen

Version:

Automatically generate TypeScript interfaces from JSON data, API responses, or database schemas. Perfect for Mongoose, Sequelize, and raw data. Simplify your workflow and ensure type safety with just one function call!

16 lines (15 loc) 470 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.normalizeData = normalizeData; function normalizeData(data) { // Handle Mongoose documents if (data && typeof data.toObject === "function") { return data.toObject(); } // Handle Sequelize instances if (data && typeof data.toJSON === "function") { return data.toJSON(); } // Handle raw MySQL data (no normalization needed) return data; }