typicaljoe / taffydb

TaffyDB - an open source JavaScript Database for your browser
http://taffydb.com
MIT License
2.21k stars 286 forks source link

taffy 2.7.x breaks its own `column: {isUndefined: true}` filter #159

Open GerHobbelt opened 5 years ago

GerHobbelt commented 5 years ago

Taffy releases since 2.7 break query logic like this (as used in jsdoc-to-markdown a.k.a. jsdoc2md npm package):

data({access: {isUndefined: true}}).remove();

Analysis

Good release: 2.6.2 Bad release: 2.7.3

Next, I've done a quick source compare and after a couple of false hunches this bit of Taffy code in matchFunc turns up as the bad egg:

                if (typeof mvalue === 'undefined') {
                  return false;
                }

Killing that bit of code restores the old 2.6.2 behaviour re those jsdoc2md tests which use isUndefined filter code as shown at top.

git bisect + $ grep -i "typeof mvalue === 'undefined'" taffy.js as the good/bad test then quickly lead to this commit being the point where this bug has been introduced:

$ git bisect good
968b5cf9e85ad741e787690a39809fd685070e90 is the first bad commit
commit 968b5cf9e85ad741e787690a39809fd685070e90
Author: typicaljoe <ian@individualist.com>
Date:   Mon Feb 25 22:41:27 2013 -0800

    Update TaffyDB to 2.7 with a large number of changes

    Large number of style changes, bug fixes, and tweaks. Big thanks to everyone who has helped!

:100644 100644 61802b4aa323c38c1945179a67f76059bbf4489a 2212e3b34d9f76fa69f35511ab3c932dae6e7109 M      taffy.js

The new (bad) code results in this bit never being reached:

!TAFFY.isUndefined( mvalue )

and hence the filter code

data({access: {isUndefined: true}}).remove();

is now dead in the water.

Conclusion

For jsdoc2md at least this means it devDependency taffydb cannot be updated to 2.7.x until this bug is fixed.