Wednesday, April 20, 2022

New top story on Hacker News: Show HN: DTL: a language and JavaScript lib to transform and manipulate data

Show HN: DTL: a language and JavaScript lib to transform and manipulate data
15 by jk0ne | 1 comments on Hacker News.
DTL is a project that began it's life as part of a another piece of software for a startup I founded a few years ago. For that project I needed a way to describe how to rewrite data in a portable way. I needed to be able to create the rules on the fly and store them in a database, I needed them to be able to describe transformations I hadn't thought about, but also needed them to be safe and predictable. Though the startup didn't survive, the language I made was so useful to me I felt I had to extract it and make it usable to everyone. DTL is the result. Though the npm module is relatively new, the language itself has been in use in production systems for years. Over the past couple of years I have been working to make it more accessible and useful to newcomers. Though it's really powerful, I tried to make it easy to use and simple to understand so that you can get up to speed quickly and use only as much as you need. To summarize: DTL is a javascript module and related CLI tools that are really handy for transforming data from one format to another. It's made to allow you to specify your transformations as data (JSON by default) which means they are easily shared from frontend to backend and vice versa, as well as making them easily stored in databases, etc. It can be used as part of your project to transform data between APIs, between the frontend and your database, etc. and can do simple mappings as well as complex calculations. It can also be used for validation and is really handy for extracting useful information from large / complex datasets (there are some great examples of this you can try on the website). The CLI tool (dtl) is like jq on sterooids, allowing you to slice, dice and remap csv, yaml, json or even plaintext data doing anything you can describe in a DTL transform. If you ever wished you could `grep` in complex data structures, today is your lucky day. :) I'd love any feedback you have and if you think of anything it doesn't have that it should, I'd love to hear that too.

No comments:

Post a Comment

Biden's move on missiles for Ukraine angers Trump allies

It is not clear if Biden's decision will be endorsed by Donald Trump who has promised to end the Ukraine war. from BBC News https://if...