Skip to content

Conversation

@flovilmart
Copy link
Contributor

No description provided.

@flovilmart flovilmart requested a review from acinader October 3, 2017 15:39
});

function pointer(className, objectId) {
return {__type: 'Pointer', className, objectId };
Copy link
Contributor

Choose a reason for hiding this comment

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

add whitespace between { __

return query.className + ':' + sections.join('|');
}

/**
Copy link
Contributor

Choose a reason for hiding this comment

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

"whether" and "constraint" are misspelled. I haven't read the code yet, but I really can't understand this comment.


/**
* contains -- Determines wether a constaint in for form of a list
* contains a particular object.
Copy link
Contributor

Choose a reason for hiding this comment

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

"comparison" is misspelled.

function contains(compareTo: Array, object: any): boolean {
if (object.__type && object.__type === 'Pointer') {
for (const i in compareTo) {
const ptr = compareTo[i];
Copy link
Contributor

Choose a reason for hiding this comment

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

===

* contains -- Determines wether a constaint in for form of a list
* contains a particular object.
* This also supports, pointer comparion and strings as lightweight pointers
*/
Copy link
Contributor

@acinader acinader Oct 3, 2017

Choose a reason for hiding this comment

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

The names of the parameters are confusing to me. particularly compareTo.

haystack, needle?

@codecov
Copy link

codecov bot commented Oct 3, 2017

Codecov Report

Merging #4231 into master will decrease coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4231      +/-   ##
==========================================
- Coverage   92.24%   92.22%   -0.02%     
==========================================
  Files         116      116              
  Lines        8098     8107       +9     
==========================================
+ Hits         7470     7477       +7     
- Misses        628      630       +2
Impacted Files Coverage Δ
src/LiveQuery/QueryTools.js 93.97% <100%> (+0.34%) ⬆️
src/RestWrite.js 93.16% <0%> (-0.56%) ⬇️
...dapters/Storage/Postgres/PostgresStorageAdapter.js 96.62% <0%> (+0.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 23bffc8...ea62945. Read the comment docs.

@flovilmart
Copy link
Contributor Author

Thanks for the quick review @acinader !

acinader
acinader previously approved these changes Oct 3, 2017
Copy link
Contributor

@acinader acinader left a comment

Choose a reason for hiding this comment

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

lgtm. I'm offering an alternative intro comment for your contain function, for your consideration.

return query.className + ':' + sections.join('|');
}

/**
Copy link
Contributor

Choose a reason for hiding this comment

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

how about:

Determines if an object is contained in a list with special handling for Parse pointers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

LOVE it!

@flovilmart
Copy link
Contributor Author

seems that eslint don't catch issue when doing typeof undefinedVariable 

}
if (typeof object !== 'undefined' &&
ptr.className === needle.className &&
if (ptr.className === needle.className &&
Copy link
Contributor

Choose a reason for hiding this comment

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

that seems good, you've already validated that needle is not undefined in the conatining if.

Copy link
Contributor

Choose a reason for hiding this comment

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

not really sure if we should be forcing

typeof needle !== 'undefined'

over

if(needle)

I use the second form in my code. Obviously could be an issue in the case of boolean but i just ignore 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.

Obviously could be an issue in the case of boolean but i just ignore that...

if it's a boolean, we'll go to the 'indexOf' case which is correct :)

Copy link
Contributor

Choose a reason for hiding this comment

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

yup, i was musing out loud more generally about if we should enforce a more formal test than just if(foo) without advocating that we switch to it.... :). so safe to ignore me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

all those bottom values in JS makes it difficult to make it consistent :/

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.

3 participants