Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do has and hasAll work? #19

Open
andrasf opened this issue Aug 28, 2012 · 3 comments
Open

Do has and hasAll work? #19

andrasf opened this issue Aug 28, 2012 · 3 comments

Comments

@andrasf
Copy link

andrasf commented Aug 28, 2012

How are has and hasAll supposed to work?

In case of
var db = TAFFY([ {"author": "name", "title": "anything", "keywords": ["a", "b"]}, {"author": "name", "title": "anything", "keywords": []} ]);

Both rows are returned for db({keywords: {has: 'a'}}) and for db({keywords: {hasAll: ['a', 'b']}}). Is this normal? How can I query this array?

@andrasf
Copy link
Author

andrasf commented Aug 28, 2012

Code.

<script>
var db = TAFFY([
{"author": "name", "title": "anything", "keywords": ["a", "b"]},
{"author": "name", "title": "anything", "keywords": []}
]);
console.log(db({keywords: {has: 'a'}}).get());
console.log(db({keywords: {hasAll: ['a', 'b']}}).get());
</script>

@leaanthony
Copy link
Contributor

I have found the bug and made a patch. You can find it in the pull requests or in my local copy.

Cheers.

@danyg
Copy link

danyg commented Apr 28, 2013

The bug appears in TAFFY.has when check for var1.TAFFY, if var1 is undefined the code explode. You must check undefined !== var1 && var1.TAFFY

danyg added a commit to danyg/taffydb that referenced this issue Apr 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants