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

feat: END-335 support for all and some #3

Merged
merged 6 commits into from
Jan 31, 2020
Merged

feat: END-335 support for all and some #3

merged 6 commits into from
Jan 31, 2020

Conversation

tdeignan1
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Jan 17, 2020

Codecov Report

Merging #3 into master will increase coverage by 6.78%.
The diff coverage is 100%.

@@            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);
});

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.

Copy link
Contributor Author

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.

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);
});
}

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'
              },
          },
				},
			},
		};

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.

Copy link
Contributor Author

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

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.

Copy link

@townbully townbully left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@tdeignan1 tdeignan1 merged commit b259bee into master Jan 31, 2020
@tdeignan1 tdeignan1 deleted the feat/END-335 branch January 31, 2020 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants