Transform/map source object to target object with schema/map

I am looking for a robust way of mapping API fields to UI fields in a sense of something like DTOs but that doesn’t require much boilerplate code.
I have found what I think a great library that would fit my need but unfortunately it’s not longer maintained https://www.npmjs.com/package/morphism so can’t use it as is in newer projects so I wonder about making a copy of it or trying to do something similar as I can’t find anything else with such functionalities. I wonder if something similar could be achieved with use of zod and its transform option. Anyone aware of similar libs? Would zod fit in this case? The thing with zod that bother me is after failed parsing I only get the error and the part of successfully parsed input is lost. Or does zod support returning error alongside already parsed data?
npm
morphism
Do not repeat anymore your objects transformations.. Latest version: 1.12.3, last published: 5 years ago. Start using morphism in your project by running npm i morphism. There are 14 other projects in the npm registry using morphism.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server