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

Adding dotNotation property and test #48

Merged
merged 6 commits into from
Apr 13, 2017
Merged

Conversation

nlundquist
Copy link
Contributor

Resolves #47.

var prop = props.dotNotation('n.p'),
alg = new set.Algebra(prop),
res = alg.has({'n.p': 'IL'}, {n:{p:'IL'}});
ok(res, "object with nested property is member of set using dotNotation");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was also looking for a way to test the unpredictable argument order handling. Tried an alg.has with the arguments reversed, and my comparator returns true in that case, but alg.has was still returning false. I'm guessing another 'default' prop was doing its own check and returning false.

Anyone have an idea how I could test that via an algebra operation?

Copy link
Contributor

Choose a reason for hiding this comment

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

I probably should understand this, but I don't, what causes the argument order to be unpredictable?

Copy link
Contributor

@phillipskevin phillipskevin left a comment

Choose a reason for hiding this comment

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

Looks good. Just have a couple of questions.

*/
var prop = props.dotNotation('n.p'),
alg = new set.Algebra(prop),
res = alg.has({'n.p': 'IL'}, {n:{p:'IL'}});
Copy link
Contributor

Choose a reason for hiding this comment

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

Should you include a test for more than 1 level of nesting like address.state.city?

var prop = props.dotNotation('n.p'),
alg = new set.Algebra(prop),
res = alg.has({'n.p': 'IL'}, {n:{p:'IL'}});
ok(res, "object with nested property is member of set using dotNotation");
Copy link
Contributor

Choose a reason for hiding this comment

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

I probably should understand this, but I don't, what causes the argument order to be unpredictable?

…t whenever a provided value is undefined. Needed when comparing two dot notation sets.

Added set equality and subset tests.
@nlundquist nlundquist merged commit cd36b8e into master Apr 13, 2017
@chasenlehara chasenlehara deleted the add-dot-notation-prop branch October 31, 2017 05:26
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

Successfully merging this pull request may close these issues.

2 participants