Re:Show HN: JAQT – JavaScript Queries and Transformations
by allannienhuis on Monday September 16, 2024 @10:24AM
(#41556411)
one of the cases something like this is useful for is when you have user configured saved 'filters' - you can simply pass the stored object into the where clause. I agree if you're doing hard-coded queries on arrays of objects, this may not add a lot. That said, a consistent syntax for doing searches and mapping is useful - projects like lodash have that as part of their api too.
[ Parent
| on HN ]
Re:Show HN: JAQT – JavaScript Queries and Transformations
by throwitaway1123 on Monday September 16, 2024 @01:55PM
(#41558680)
This is actually a pretty decent use case for something like this. You could technically convert a user provided filter function to a string to serialize it, then recreate it using the Function() constructor, but that requires adding 'unsafe-eval' to your content security policy [1][2].
[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
[2] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Re:Show HN: JAQT – JavaScript Queries and Transformations
by allannienhuis on Tuesday September 17, 2024 @07:45PM
(#41574098)
and it requires users to define filter functions, which isn't happening with any users I deal with :)