balderdashy / waterline-sequel

A SQL generator for use in Waterline Adapters
MIT License
16 stars 61 forks source link

WhereBuilder.single returns incorrect data type if no queryObject given #25

Closed bradshja closed 9 years ago

bradshja commented 9 years ago

There is a check in WhereBuilder.single to ensure that criteria are actually passed in as queryObject, and if there are none, it returns an empty string.

This can cause problems because some code that operates on its return value expects an object, which it returns normally. The result is that calling code can check for a property called query inside the returned object, and get undefined as a result. This broke some queries for me.

bradshja commented 9 years ago

I submitted PR #26 as a possible fix for this. It fixes my case anyway.

dmarcelino commented 9 years ago

Fixed via #26, thanks @bradshja!