You know, what if we wanted to have Base64 URL encoding, right? Which is a variance of Base64. Well, it turns out, you know, even that, you know, from Base64 to Base64 URL, there are differences in APIs. Not all the options work. You know, sometimes, you know, we have to change a few things. Fortunately, both Deno and Node have this built in as part of their, you know, core libraries. And then at least those will work consistently with each other. But you still, you know, start having a lot of these options.
So, it comes up to a very important question. Why is something so common and so widely used in JavaScript have so many different ways of doing it? And why should it matter which JavaScript runtime I'm using? Why should I, as a developer, writing JavaScript need to know, okay, is this code going to run in Node or is it going to run in DNO? Which one of these basics for encoding libraries, APIs do I need to use? Oh, wait, now my company's priority has shifted, they're investing now in edge computing. Now it's going to go over to Cloudflare workers. Which one of these APIs will work there? Or how do I get it to work there? Or do I need to change all of my code that does Base64 coding to do something brand new? That's ridiculous, right? That something so common has to be such a difficult time-consuming conversation to just Base64 and a little bit of text.
What about hex encoding? What are the APIs for that? Node does it one way, and, again, it's consistent with the way it does Base64. Deno does it its own way, which is consistent with its APIs. There's nothing you can use on the browser unless you find some, you know, random module on npm, and, again, hope that it's being maintained. But how often do we come across hex encoding? It's everywhere. We see this all over the place. You know, so, again, why is it so difficult find a single API for doing hex encoding in JavaScript? It doesn't make any sense.
Alright, what if we want to look at other functionality, comparing subsets of two different binary ranges, right? Say if you want to, you know, see if one binary sequence is embedded in another binary sequence. What's the API for doing this? Is there a standard API for doing this? Well, you know, unfortunately, typed arrays and JavaScript don't do this. They don't have, you know, comparing subsets of different binary ranges. All you can do is look at an individual member, an individual item, in a typed array and compare it to another individual item in another type array. That's all you can do. You know, and unfortunately, Node and Dino, two completely different ways of doing this, and you know, it just doesn't make any sense.
What if we're accumulating stream data into a simple stream, right? We want to, you know, stream some data in, build a string from it. How do we do that in the different platforms? Again, different APIs. It works differently. It doesn't need to be. JavaScript runtimes have historically been very anti-standard library. This thought really, you know, you know, stems from, you know, this idea, we'll explore it a little bit, you know, the small core idea. You know, the underlying principal here, I mean, the idea behind it, the theory behind it is that, you know, just let the ecosystem, you know, all of you, all the developers, do whatever you want to do, right? Pick whatever dependency works for you.