I bundled together useful code that I’ve reused on several projects for translating/mapping between Javascript models and corresponding API objects, and put it up on GitHub with some documentation for you to reuse.
Technologist, founder, and teacher