I put your function into a Javascript Beautifier to try to better understand it, and I still have no idea what it's doing.
Nice idea in theory, though. I've thought about doing something similar so that when I see a publisher sale ebook price on Kobo I could have it automatically retrieve the same book on Amazon, Barnes & Noble, Google Play, and Apple Books, for the purpose of more easily populating the deal post.