-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: END-335 support for all and some #3
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3 +/- ##
==========================================
+ Coverage 45.03% 51.82% +6.78%
==========================================
Files 1 1
Lines 131 137 +6
==========================================
+ Hits 59 71 +12
+ Misses 72 66 -6 |
const result = whereFilter(condition)(data); | ||
|
||
assert.isTrue(result); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess a where filter with some for an empty array will also return false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, this is based on how Array.prototype.some and Array.prototype.every (we have chosen to alias as all) work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool
return value.every(function(v) { | ||
return whereFilter(matcher.all)(v); | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So these can nest, right?
I guess we can't ever have a property called some or all as part of job data now?
{
lines: {
some: {
data: {
all: {
value: 'good'
},
},
},
},
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If they can nest, which I think they can, it would be good to have a test for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can still use "some" and "all" as object keys. They only function in a "special" way when they are applied to an array property. Much like how use of "inq" and "eq" don't stop you from using those as property names. They only kick in as "special" when they are used on certain contexts where they only makes sense as special
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh.. that's good to know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
No description provided.