SOURCE

console.log(js_beautify)
const obj = {
    name: 'string',
    age: 'integer',
    hobby: 'string'
}


function getType(type){
    return {
        string: 'string',
        integer: 'number',
    }[type]
}
let str = '';
for (let key in obj) {
    str += `${key}:${getType(obj[key])};`
}
const res = `export interface a {${str}}`
console.log(js_beautify(res))
console.log(js_beautify("{name: 'string',age: 'integer',hobby: 'string'}"))
console 命令行工具 X clear

                    
>
console