axiodb
Version:
The Pure JavaScript Alternative to SQLite. Embedded NoSQL database for Node.js with MongoDB-style queries, zero native dependencies, built-in InMemoryCache, and web GUI. Perfect for desktop apps, CLI tools, and embedded systems. No compilation, no platfor
28 lines • 956 B
JavaScript
;
/* eslint-disable @typescript-eslint/no-explicit-any */
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = buildResponse;
/**
* Builds a standardized response object with status code, message, and optional data.
*
* @param statusCode - The HTTP status code to include in the response
* @param message - The message describing the result of the operation
* @param data - Optional data payload to include in the response
* @returns A response object with statusCode, message, and data properties
*
* @example
* // Success response with data
* buildResponse(200, "User fetched successfully", { id: 1, name: "John Doe" });
*
* @example
* // Error response without data
* buildResponse(404, "User not found");
*/
function buildResponse(statusCode, message, data) {
return {
statusCode,
message,
data: data || null,
};
}
//# sourceMappingURL=responseBuilder.helper.js.map