/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
//#region src/cli/commands/utils/sortKeys.ts
function sortKeys(unsortedObj) {
	const sortedObj = {};
	if (!unsortedObj || typeof unsortedObj !== "object") return unsortedObj;
	const keys = Object.keys(unsortedObj).sort();
	for (var index in keys) {
		const key = keys[index];
		const value = unsortedObj[key];
		if (typeof value === "object") if (Array.isArray(value)) sortedObj[key] = value.map((item) => {
			if (typeof item === "object") return sortKeys(item);
			return item;
		});
		else sortedObj[key] = sortKeys(value);
		else sortedObj[key] = value;
	}
	return sortedObj;
}

//#endregion
export { sortKeys };