4 ms·
My tiny lib with very similar functionality: [1]. The query syntax is slightly different though. Also I decided to re-use JS for evaluation of sub-expressions i
by xonix 9y ago
My tiny lib with very similar functionality: [1].
The query syntax is slightly different though. Also I decided to re-use JS for evaluation of sub-expressions instead of implementing own full-fledged parser.
[1] https://github.com/xonixx/jsqry https://github.com/xonixx/jsqry
- lioeters 9y agoI love libraries like this, which is small enough to be read in one sitting. I can scan through and get a general understanding of everything that it does. The "evaluation of sub-expressions" made me curious. This line: token.func = Function('_,i,args', 'return ' + token.val); ..could be a potential security issue with user-submitted expressions?
- xonix 9y agoThanks. I doubt this could be a security issue. Typical usage like so var name = one(users, '[_.id==?].name', 123) uses parameterized queries, same idea as with SQL to eliminate injections.
- lioeters 9y agoI see, I should have dug deeper before commenting. Wow, parameterized queries, there's been a lot of thought put into this compact library!