meocord
Version:
Decorator-based Discord bot framework built on discord.js. Brings NestJS-style controllers, dependency injection, guards, and testing utilities to bot development — with a full CLI and TypeScript-first design.
22 lines (20 loc) • 751 B
JavaScript
/**
* MeoCord Framework
* Copyright (c) 2025 Ukasyah Rahmatullah Zada
* SPDX-License-Identifier: MIT
*/ /**
* Helper function to fix common JSON formatting issues in tsconfig.json, such as:
* - Removing single-line comments.
* - Removing trailing commas.
* - Stripping newlines.
*
* @param {string} jsonString - The raw JSON string to fix.
* @returns {string} The corrected JSON string.
*/ function fixJSON(jsonString) {
return jsonString.replace(/\/\/.*$/gm, '') // Remove single-line comments
.replace(/,(\s*[}\]])/g, '$1') // Remove trailing commas before } or ]
.replace(/,\s*$/, '') // Remove trailing commas at the end of the file
.replace(/^\s*[\r\n]/gm, '') // Replace empty lines only
;
}
export { fixJSON };