feathersjs-ecosystem / feathers-reactive

Reactive API extensions for Feathers services
MIT License
216 stars 37 forks source link

inconsistent handling of undefined vs non-existent query properties #123

Open j2L4e opened 6 years ago

j2L4e commented 6 years ago

Due to serialization the query { } is equivalent to { prop: undefined } in terms of the returned results (at least over the wire).

Unfortunately, siftjs handles both cases differently which can lead to an event unexpectedly not matching the initial query:

const sift = require('sift');

console.log(sift({})({ prop: 'someid' }));                  // true
console.log(sift({ prop: undefined })({ prop: 'someid' }));     // false

One q'n'd way to solve this would be stringifying and reparsing the query before passing it to sift. Maybe it's even the best way to ensure client/server consistency.