Live data from Hacker News

Show HN: JAQT – JavaScript Queries and Transformations

github.com

1–10 of 40 posts

Show HN: JAQT – JavaScript Queries and Transformations

#1
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!

Show HN: JAQT – JavaScript Queries and Transformations
github.com

Re: Show HN: JAQT – JavaScript Queries and Transformations

#6

Wouldn't the query for your example just be data.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

I liked JAQT API but it is not really good to create a layer on top of already simple functional constructors.

Re: Show HN: JAQT – JavaScript Queries and Transformations

#8
post #4

can a query like that be observable? so updating the array/object would cause the results to update?

AFAICT this library generates "flat" JSON objects. Wouldn't be too hard to implement it such that references to Javascript objects are instead returned, where some sort of callback could be invoked whenever the actual object is modified. I do rather like this "query engine" approach, too. It's a much cleaner interface IMO and doesn't seem to incur too much overhead either....

Re: Show HN: JAQT – JavaScript Queries and Transformations

#9
post #7

In a similar vein is https://pbeshai.github.io/tidy/ which I've used for 3+ years. It's a really nice lightweight transformer. I've also used https://github.com/uwdata/arquero once (better performance for large datasets).

any idea what does tidy uses internally? or is it iterating over entire array for every operation?
Post reply on HN