UNPKG

intlayer-editor

Version:

Integrate the Intlayer visual editor into your Intlayer projects, enabling CMS-like content management with multilingual support.

32 lines (30 loc) 1.1 kB
import { HttpStatusCodes } from "./httpStatusCodes.mjs"; //#region src/utils/responseData.ts const isSuccessStatus = (status) => status === 200 || status === 201 || status === 202 || status === 203 || status === 204 || status === 205 || status === 206 || status === 207 || status === 208 || status === 226; function formatResponse({ message, description, data, error, status = 200 }) { return { success: isSuccessStatus(status), message: message ?? void 0, description: description ?? void 0, data: data ?? null, error: error ?? void 0, status }; } function formatPaginatedResponse({ status = 200, message, description, data, error, page, pageSize, totalPages, totalItems }) { return { success: isSuccessStatus(status), message: message ?? void 0, description: description ?? void 0, data: data ?? null, error: error ?? void 0, status, page: page ?? null, page_size: pageSize ?? null, total_pages: totalPages ?? null, total_items: totalItems ?? null }; } //#endregion export { formatPaginatedResponse, formatResponse }; //# sourceMappingURL=responseData.mjs.map