Public vals
167
tmcw
kyExample
Script
ky The ky module is a nice abstraction around the fetch API , which is easily compatible with Deno. It's by the same creator as got , which more explicitly targets Node.js. Most of the time, the fetch method is all you need! But in a pinch, you can use ky to make things a little fancier.
0
tmcw
xastscriptExample
Script
xastscript xastscript is a great way to safely generate XML from within JavaScript - it provides a sort of 'Domain Specific Language' for building XML trees, and then you can encode that into XML using xast-util-to-xml . For example, we at Val Town use xastscript and these utilities to generate our sitemap.xml file for Google to discover vals.
0
tmcw
litExample
Script
lit Lit is kind of like Google's answer to React: it's a little more reliant on browser APIs like custom elements and the shadow DOM, a little less 'magic', like using JSX. This is an example of using Lit and rendering it straight to a string, which is something that's recently popular. It works pretty well, right off the bat: Lit provides nice ESM modules and a pretty smooth workflow!
0
tmcw
qsExample
Script
qs QS is a pretty old module that you probably shouldn't use but it's still pretty heavily used. In the very very early days there wasn't a built-in way in JavaScript to parse querystrings. So QS was born. But then, Node.js added a querystring module built-in. Then, JavaScript introduced URLSearchParams , which you should use whenever you want to parse or generate query strings.
0
tmcw
punycodeExample
Script
punycode punycode is so cool. It's esoteric, but like, it's amazing what ingenuity can do. It's an encoding of UTF-8 - the kind of text with easy representations for unicode sequences like ñ - in ASCII - the one that just supports English. It does this in a way that's reversible, and lets us use UTF8 text in ASCII places, because you can also detect when something is written in punycode. Do you need this, probably not – but someday you will, and you will remember.
0
tmcw
acornExample
Script
acorn Acorn is a JavaScript parser written in JavaScript! It's one of the most established, and best, options - written by the same main contributor as CodeMirror and ProseMirror. At Val Town, we use Acorn internally, as well as CodeMirror for the code editor. With Acorn, you can parse JavaScript, modify it, and generate strings from that parsed JavaScript. It's a lot more robust and productive than processing source code as strings.
0