export function sortObject(obj) {
    return Object.keys(obj)
        .sort()
        .reduce((acc, key) => {
        acc[key] = obj[key];
        return acc;
    }, {});
}
export function jsSafeName(name) {
    return name
        .split(/[^a-zA-Z0-9]/)
        .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
        .join('');
}
export function formatCommand({ command, args, }) {
    return `${command} ${args.join(' ')}`.trim();
}
// Turn GitHub URLs into raw URLs
export function handleSpecialURL(url) {
    if (url.startsWith('https://github.com/') && url.includes('blob')) {
        return url
            .replace('https://github.com/', 'https://raw.githubusercontent.com/')
            .replace('/blob/', '/refs/heads/');
    }
    if (url.startsWith('https://github.com/') && url.includes('tree')) {
        return url
            .replace('https://github.com/', 'https://raw.githubusercontent.com/')
            .replace('/tree/', '/refs/heads/');
    }
    return url;
}
export function hasDrive(path) {
    return /^[A-Za-z]:/.test(path);
}
export function stripDrive(path) {
    return path.replace(/^[A-Za-z]:/, '');
}
