How to refactor a function full of conditionals ?
This function is basically gonna keep growing with a lot more conditionals based on the type attribute what would be the best way to refactor it ?
https://gist.github.com/amineMbarki1/38762f4453d68a7dfc987ec4d58e84c5