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
getValueForExpr: add support for arrays #10627
getValueForExpr: add support for arrays #10627
Conversation
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
0c06519
to
e9e471b
Compare
CLAs look good, thanks! |
I find this unnecesary complicated, it would be sufficient to use (maybe better formated and/or with variables): - if (!isObject(value) ||
+ if (!(isObject(value) || isArray(value))||
value[part] === undefined ||
!hasOwnProperty(value, part)) {
value = undefined;
break;
} The flow is harder to follow with the added |
src/json.js
Outdated
} | ||
value = value[part]; | ||
if (isObject(value) && |
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.
We could likely just remove this in favor of a truthy check:
if (value && value[part] !== undefined && hasOwnProperty(value, part)) {
//...
}
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.
great feedback y'all! I've added a commit that I hope addresses all of your comments
Exciting stuff, thanks @gilbox! |
This issue seems to be in Pending Triage for awhile. Please triage this to an appropriate milestone. |
Apologies for letting this fall through the cracks. |
* getValueForExpr: add support for arrays * code review: simplify * lint 🐒
getValueForExpr: add support for arrays
Solves #10613 by adding support for array indexes for the
items
attribute ofamp-list
.