neverstew
Twice called wise. 🧐
Building a better world at https://equalcare.coop.
Joined January 12, 2023
Public vals
123
superchargedQueryParams
@neverstew
Script
⚡ Supercharge your query params Tired of the old x=y query param limitations?
Ever wished you could say x>y or x!=y as well? Now you can! Parse query params with superchargedQueryParams and you get an array of operations for each parameter instead: import { superchargeQueryParams } from "https://esm.town/v/neverstew/superchargeQueryParams";
console.log(superchargeQueryParams(new URL("https://example.com?a=b&c>d&e!=f&e>=g")))
// {"a":[{"eq":"b"}],"c":[{"gt":"d"}],"e":[{"ne":"f"},{"gte":"g"}]}
blobDirList
@neverstew
Script
List things in a blob directory Blobs can be organised using "directories" e.g. /animals
all-animals.txt
/dogs
sausage.txt
/cats
tom.txt is really only three files: /animals/all-animals.txt , /animals/dogs/sausage.txt and /animals/cats/tom.txt because directories don't really exist, we're just making longer filenames. When you want to list things only "in a directory" and none of the child "directories", you can use this val. import { blobDirList } from "https://esm.town/v/neverstew/blobDirList";
console.log(await blobDirList("/animals"));
// returns only "/animals/all-animals.txt"