Show HN: JAQT – JavaScript Queries and Transformations (github.com)
Hi all,
I've made a javascript library to simplify searching/sorting/filtering in arrays of objects. Its inspired by both GraphQL and SQL, but implemented using javascript Proxies. Instead of creating a new language, its all just javascript.
I've made it as part of an experimental database, which uses javascript as the query engine. The normal javascript map/reduce/sort functions are quite difficult to master for junior developers. JAQT is easier to explain, and can still be used in combination with any existing array functions.
Please let me know what you think of the API and its ease of use!
39 comments
[ 4.3 ms ] story [ 100 ms ] threaddata.filter(d => d.friends.includes("John")).map(d => ({name: d.name+" "+d.lastName}))
Maybe I'm missing the bigger picture, but that doesn't seem so bad
That’s certainly a logically consistent position, but it isn’t one that allows much room for anything to improve… or even become a productive discussion.
It is perfectly reasonable to ask whether something for convenience adds value to something also for convenience.
Nearly everything in any high level language isn’t strictly necessary to achieve general purpose computation. That doesn’t invalidate any distinction between all higher level concepts! They specifically add expressiveness, so it’s eminently meaningful—for people who find expressiveness valuable—to discuss and distinguish between like solutions in those terms.
> They specifically add expressiveness
Not really. Expressiveness is the ability to achieve the same end state in different ways. How do you then determine that? You have to count the different ways a given thing is achieved. Under the abstraction if its doing the same thing in the same way as something else then its not really different, and thus not expressive. That is why these large SPA frameworks have wildly different super large APIs, but their output is strikingly similar, which isn't expressive at all. Really, with these tools none of that matters, because its really just about the perceptions of convenience.
Lodash does way more than some basic functional wrappers. I've seen too many buggy re-implementations of debounce, throttle and groupBy at this point, it's not even funny.
[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
[2] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
I've also used https://github.com/uwdata/arquero once (better performance for large datasets).
Typically I use something like JSONPath [1] (basically XPath for JSON) [2] or jq for this but having more options with other syntax and style is helpful.
For streamed JSON like NDJSON [3] there are some nice filtering options [4]
[1] https://en.wikipedia.org/wiki/JSONPath
[2] https://datatracker.ietf.org/doc/html/rfc9535
[3] https://github.com/ndjson/ndjson-spec
[4] https://github.com/mbostock/ndjson-cli?tab=readme-ov-file#fi...