-
Notifications
You must be signed in to change notification settings - Fork 26.9k
build(docs-infra): improve directive API doc templates #25768
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
Changes from all commits
9837e10
cb70463
35aa44f
e4bc804
b99c868
ff74726
ac7d689
fe41985
4973ddc
9bbab42
d5710f0
84fcf21
562b6d3
e6f728f
5e8ebcc
28dae87
779ca39
9210090
a5d9691
d882c07
9772127
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| module.exports = function() { | ||
| return {name: 'selectors'}; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,21 @@ module.exports = function hasValues() { | |
| name: 'hasValues', | ||
| process: function(list, property) { | ||
| if (!list || !Array.isArray(list)) return false; | ||
| return list.some(item => item[property]); | ||
| return list.some(item => readProperty(item, property.split('.'), 0)); | ||
| } | ||
| }; | ||
| }; | ||
| }; | ||
|
|
||
| /** | ||
| * Search deeply into an object via a collection of property segments, starting at the | ||
| * indexed segment. | ||
| * | ||
| * E.g. if `obj = { a: { b: { c: 10 }}}` then | ||
| * `readProperty(obj, ['a', 'b', 'c'], 0)` will return true; | ||
| * but | ||
| * `readProperty(obj, ['a', 'd'], 0)` will return false; | ||
| */ | ||
| function readProperty(obj, propertySegments, index) { | ||
| const value = obj[propertySegments[index]]; | ||
| return !!value && (index === propertySegments.length - 1 || readProperty(value, propertySegments, index + 1)); | ||
|
||
| } | ||
|
||
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.
Now that whitespace is significant, helpers that render inside these code blocks (
renderMemberSyntaxor similar) need to be more "careful" to avoid:I manually tweaked the last entry to remove whitespace.
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.
fixed in 8d644eec178199d4629d9c4fd0e55b81586635ba