-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Pie aggregation and event cleanup #2117
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 4 commits
679ed9c
ce8946c
d2756f1
ebc4d8b
5d0f3e2
e08e37a
4ba0249
ee1f8c4
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 |
---|---|---|
|
@@ -25,3 +25,16 @@ exports.formatPieValue = function formatPieValue(v, separators) { | |
} | ||
return Lib.numSeparate(vRounded, separators); | ||
}; | ||
|
||
exports.getFirstFilled = function getFirstFilled(array, indices) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Picking the first non-empty item is fine 👍 |
||
if(!Array.isArray(array)) return; | ||
for(var i = 0; i < indices.length; i++) { | ||
var v = array[indices[i]]; | ||
if(v || v === 0) return v; | ||
} | ||
}; | ||
|
||
exports.castOption = function castOption(item, indices) { | ||
if(Array.isArray(item)) return exports.getFirstFilled(item, indices); | ||
else if(item) return item; | ||
}; |
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.
Blocking: Would you mind locking this down in a jasmine test?
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.
sure -> ee1f8c4
It was done in the image test I added, but nice to have it in jasmine too.