axemclion / jquery-indexeddb

An IndexedDB Plugin for Jquery.
Other
195 stars 71 forks source link

Ranges always excluding bounds #28

Closed ChristophGr closed 11 years ago

ChristophGr commented 11 years ago

You use this snippet: return IDBKeyRange.bound(r[0], r[1], r[2] || true, r[3] || true);

when specifying a range [1, 5, false, false] the expressions evaluate to true and the range will end up excluding the bounds.

Also I think the default should including bounds (as in indexedDB-API).

pjeby commented 11 years ago

Quick suggestion for a fix:

return IDBKeyRange.bound(r[0], r[1], r.length>2 ? r[2] : true, r.length>3 ? r[3] : true);
axemclion commented 11 years ago

This could be a problem if r = [1,2, undefined, false] - not sure why a user would do that though :full_moon_with_face:

So changing it to actually checking if the value is undefined, and assigning the default value. [Ashamed that I Wrote this code :( ]