localbase
localbase copied to clipboard
fix: when collection does not have property, should still sort
There's an issue when collection does not have a property when performing orderBy.
For example: Let's say you store multiple entities... as cats.
- {name: "socks", born: "2001"}
- {name: "ginger"}
- {name: "furball, born: "2020"}
If you use the existing code and try orderBy('born') it will explode💥 because the property "born" for ginger does not exist.
The fix Essentially it just does a simple check that both compared entities, both have the desired property.
Hope this helps.