julesfern / spahql

A query language for Javascript data. Extracted from Spah.
MIT License
325 stars 20 forks source link

Documentation makes no reference to determining resultset length #8

Open fredweppes opened 12 years ago

fredweppes commented 12 years ago

Hello, Trying to use SpahQL and so far I think it is great. Only ran into a single issue - if I query the DB using select and my query has no results, I don't know how to catch it, since it still returns an object. There is also no example in the documentation. Thank you, Fred

julesfern commented 12 years ago

Hi Fred,

The returned SpahQL object extends Array, so you can call .length on it directly:

db.select("/key/that/does/not/exist").length > 0

I've made a note to improve the documentation in this regard and I'll leave this ticket open until I've made that change.