CamelCase

    [자바스크립트, TS] camel case의 object key를 snake case로 바꾸기

    개발을 진행하다 Hasura에 query의 결과값으로 받아오는 object의 key가 snake case인데 실제 개발 컨벤션은 camel case여서 코드내에서 query한 결과값을 insert할때 다시 넣어줘야 하는 번거로움이 있었다. const originalSnake = { hello_world: "hihi", hi_there: "hi there", }; const insertObject = { helloWorld: originalSnake.hello_world, hiThere: originalSnake.hi_there, }; console.log(originalSnake); console.log(insertObject); /* { hello_world: 'hihi', hi_there: 'hi t..