arch-js / arch

Web application framework for React by Red Badger
BSD 3-Clause "New" or "Revised" License
170 stars 13 forks source link

Should the cursor have an isEmpty method? #55

Closed dpiatek closed 9 years ago

dpiatek commented 9 years ago

I've came across a situation where we need to dereference a cursor to check if it's falsy because on a deeper level, a sub cursor is returning null and is being accessed by an index, so throws an error.

Normally this could be avoided by defaulting to an empty array, but because it's a sub-cursor, that's not really managable (the sub-cursor tree is big).

This could be avoided also by having a method on the cursor that could tell you if your data is falsy - but perhaps this should stay out of cursor? WDYT?

charypar commented 9 years ago

Yeah, I think that's a good idea.