Working with the new expansions and includes in v2 can be difficult if your pipelines are built around processing one tweet at a time. This has led some libraries like twarc to incorporate a flatten function, which transposes the included entities into the respective tweet objects.

I needed to do the same thing from JavaScript and so I ported @igorbrigadir’s Python code from twarc over to a JavaScript function. I thought it could be of use to others so I pushed it up to npm:

3 Likes

I commented in a different thread already on this, but I just wanted to say this is very awesome! I’ve also shared this with a few other members of the team as well :tada::tada:

3 Likes